# Camera vibrating on colliusion

https://playground.babylonjs.com/#4HUQQ#1604

Hello guys, when i try to move through between 2 boxes and keep pressing forward, camera is vibrating. Is there any solution for this? I expect camera to stand still

1 Like

Thatâ€™s a tough one

You are trying to collide against one box, so the collider moves you to the other side, and then, one frame after, the collider correct back, because you collide with the other box. and this will go on until you stop moving forward.

What you can do is check for your keyboard input yourself, and check against what element you are collided. Having said that, since you are also colliding constantly against the floor (you are â€śwalkingâ€ť on it) it is not so trivial.

1 Like

Hmm, if you reduce the width of the cameraâ€™s collision body from 0.5 to 0.3, that seems to fix the vibrating issue: https://playground.babylonjs.com/#4HUQQ#1607

Alternatively, making the gap between the barrels larger helps reduce the amount of vibration as well.

So maybe itâ€™s a matter of avoiding the edge cases where the size of camera.ellipsoid is too close to the size of the gap between objectsâ€¦

Thanks for the reply, unfortunately this is not a solution for my case. In my project there are several gaps like this and the gap sizes are different from each other

Thanks for the reply. What am I going do with that input and collusion information? Could you drop a PG sir?

Similar topic, https://playground.babylonjs.com/#4HUQQ#1610
If you try to move on the box below(like staircase), camera vibrates. In my case, camera shouldnâ€™t move above the staircase and shouldnâ€™t vibrate. You can change the gravity. I tried fixed â€ścamera.position.yâ€ť to a constant in â€śscene.registerBeforeRenderâ€ť function but still vibrates

It has a lot to do with your overall character and scene definition. The gravity, the size of the step, the ellipsoid.

Change your ellipsoid to something larger than 1 on the y axis (try 1.2 or 1.3 for example), you will see that you climb the step. The entire scene is â€śright on the thresholdâ€ť, so it continuously tries to climb up and then gravity takes it down. You could also lower the gravity, make a slightly smaller step, or increase the cameraâ€™s movement speed. All of those factors will influence collision one way or the other. And you will need to adjust them to your needs, of course.

1 Like