Camera inertia vibrates on collision

Hello! Currently I’m trying to implement a scene without any form of gravity, just setting the player.y position each frame (as the player height).
Wanting to have basic collisions as well I enabled that. But when I’m colliding with something, at first it seems it functions fine, camera gets blocked by the box. But if you look closely, you can see (what I assume is the camera inertia) being applied after releasing any held movement key and thereby giving this vibrating visual effect shortly after.


cc @Cedric our king of everything physics :slight_smile:

I don’t see the vibrating effect. I guess I’m not looking at the right thing.
Anyway, you can improve the collision/response quality with collisionRetryCount like in this PG:
planet | Babylon.js Playground (

It might be a bit easier to notice if you clip through the box a bit with the frustum near plane.
After you’ve collided, release the key and you should be able to spot ever so slightly the vibration right after.

Here’s the new PG:

I think I see the vibration. This is caused by the algorithm that tries to slide along the surface (more back because of collision, slide a little, move forward and so on). It’s also caused by the camera inertia.
At his point, the only solution I see is to recode a (big) portion of the collision/response system. Which might not happen soon because of next release and code freeze.
To mitigate the issue, you can set camera.inertia to a lower value or even 0.
Or maybe with a bit more work, use a physics impostor with the camera attached to a sphere.

1 Like

I see, thanks for looking into it and giving some feedback :smiley:
I’ve tested a bunch myself and it seems that enabling gravity, ground collisions and setting proper collider dimensions on the camera, also revents the vibration from happening.

If I find some other solutions I will most likely post some update progress here for some workarounds.

Wish you a great day!