Not getting collision callbacks with physics

Hi,

Currently I am working in a breakout clone game:

I have the same problem defined in this thread that Igor explained. Even with CCD, when frames drop the collision between the ball(s) and the bricks is made but the callback is not fired. But the problem in my case don’t think that can be resolved with raycasts though.

I am not sure if checking all bricks for distance in every frame is the best solution, keeping in mind that the game is already slowed.

The link to the project is: https://playcanvas.com/project/652053/overview/breakout-3d the if you want to check.

Any kind of solution is very much appreciated.

Is the ball going through the blocks?

You may want to try changing the timestep: [SOLVED] Ammo timesteps?

Thanks for the quick reply!

Is the ball going through the blocks?

No, the ball never go through the blocks.

I have tried both the fixedSubSteps and the maxSubSteps but that can’t solve the problem, I have not noticed any difference. Still does not make any sense for me. If the collision is clearly working, what could cause the event to not being called?

If it’s never going through the blocks then it’s a different problem. I thought this was fixed a while back :thinking:

How do you reproduce the bug?

I lowered the FPS to like 10-20, but I still see the callbacks from collision on both the bricks and the ball.

I have created a simple project just for simplicity:

https://playcanvas.com/project/709597/overview/test

I had tested my original project with Chrome, using CPU throttling:

But didn’t experienced the problem in the sample project. I have reimported ammo library and the problem seems to be gone.

Knowing that the project is ~9 months long and the ammo library is attached to the project, just to be sure, maybe some issue related with callbacks has been solved already in the ammo library? I have checked their repository commit history, but I really can’t know if something has changed.

Thanks @LeXXik for checking the project! I was just writing this response already

When was the last time you updated the Ammo library?

There were changes in the engine regarding how it handles collisions, I don’t know, like several months ago? Easiest way to check is to simply remove the Ammo folder from the project and re-import it from the settings. This should use the latest version.

1 Like

@yaustar in December, when the project was created :joy: I didn’t realized that could be a problem until now

@LeXXik Yes, that was what I did. If that is correct then it could be just that!

As the editor is using the stable version, maybe it could be nicer to have just some option to import the physics library without bothering to have the library inside the assets folder.

I think it is needed for version interoperability? Future Ammo release may introduce a breaking feature, so it won’t automatically break your app.

It’s also so that the app is not tied to a version that PlayCanvas has to maintain (e.g if you wanted different features etc).

1 Like