Collision Events not firing properly when increasing fixedTimeStep

Hi, Im making a pinball game and I had an issue where the ball was going through the pads(flippers) and walls, so I found a solution that was to increase the fixedTimeStep, normally the value should be 1/60, so I increased like so: = 1/120;

This fixed the collision problem, the ball was not going through the pads and walls anymore, but it gives me another problem that I dont seem to get a solution for, now collision events (this.entity.collision.on(‘collisionstart’, this.onCollisionStart, this);) dont always fire when there’s a collision.

Any help?

Not sure why changing the fixedTimeStep would cause that issue but you may want to consider enabling CCD on the rigid bodies to stop objects going through each other:

1 Like

First of all, thank you for your reply

Thats exactly what I needed, this really could be in the docs, also in the properties of the rigidbody component

Only problem is that the ball is still going through the flippers, so I figured I could apply CCD not only on the ball but on the flippers too, the problem is I dont know how should I set the sweptSphereRadius, because the pads are rectangles and not spheres, and my auto complete shows nothing after “body” on “this.entity.rigidbody.body.

Do you know where can I find any documentantiona bout this, or how to set it properly for non sphere objects?

IIRC, it shouldn’t matter what shape the the object actually is because the sweptSphereRadius is a ‘broad sweep’.

The physics engine is ammo.js which is the Bullet physics library ‘compiled’ into JS via emscripten (IIRC). This isn’t exposed in PlayCanvas so you would have to dig around the Bullet documentation and hope that ammo.js has exposed it.

You can see what is exposed here:

1 Like