# Camera vibrating on colliusion

**URL:** <https://forum.babylonjs.com/t/camera-vibrating-on-colliusion/23362>\
**Category:** Questions\
**Tags:** camera\
**Created:** [August 26, 2021, 1:10pm UTC](https://forum.babylonjs.com/t/camera-vibrating-on-colliusion/23362 "2021-08-26T13:10:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yunus\_Tencere](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yunus_tencere/32/12100_2.png) [@Yunus\_Tencere](https://forum.babylonjs.com/u/Yunus_Tencere)\
**Post date:** [August 26, 2021, 1:10pm UTC](https://forum.babylonjs.com/t/camera-vibrating-on-colliusion/23362/1 "2021-08-26T13:10:41Z")

</div>

[https://playground.babylonjs.com/#4HUQQ#1604](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

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [August 26, 2021, 3:17pm UTC](https://forum.babylonjs.com/t/camera-vibrating-on-colliusion/23362/3 "2021-08-26T15:17:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Blake](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/blake/32/21509_2.png) [@Blake](https://forum.babylonjs.com/u/Blake)\
**Post date:** [August 26, 2021, 4:18pm UTC](https://forum.babylonjs.com/t/camera-vibrating-on-colliusion/23362/4 "2021-08-26T16:18:17Z")

</div>

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](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…

---

<div class="post-metadata">

**Author:** ![Yunus\_Tencere](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yunus_tencere/32/12100_2.png) [@Yunus\_Tencere](https://forum.babylonjs.com/u/Yunus_Tencere)\
**Post date:** [August 26, 2021, 4:28pm UTC](https://forum.babylonjs.com/t/camera-vibrating-on-colliusion/23362/5 "2021-08-26T16:28:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Yunus\_Tencere](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yunus_tencere/32/12100_2.png) [@Yunus\_Tencere](https://forum.babylonjs.com/u/Yunus_Tencere)\
**Post date:** [August 26, 2021, 4:33pm UTC](https://forum.babylonjs.com/t/camera-vibrating-on-colliusion/23362/6 "2021-08-26T16:33:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Yunus\_Tencere](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/yunus_tencere/32/12100_2.png) [@Yunus\_Tencere](https://forum.babylonjs.com/u/Yunus_Tencere)\
**Post date:** [August 26, 2021, 4:56pm UTC](https://forum.babylonjs.com/t/camera-vibrating-on-colliusion/23362/7 "2021-08-26T16:56:10Z")

</div>

Similar topic, [https://playground.babylonjs.com/#4HUQQ#1610](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

---

<div class="post-metadata">

**Author:** ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)\
**Post date:** [August 27, 2021, 9:26am UTC](https://forum.babylonjs.com/t/camera-vibrating-on-colliusion/23362/8 "2021-08-27T09:26:39Z")

</div>

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.
