Camera gravity and slope collisions

Hello :slightly_smiling_face:
I am having some issues with gravity and collisions with a slopped mesh.
I’ve found this topic (link bellow) which helped however i can’t seem to get it working. What i took from it is that collision with low height objects is to be avoided. However i dont think i can avoid it, instead, as mentioned in the topic’s solution i tried to tinker with the ‘engine.collisionsEpsilon’ property (lowering it). It had no effect at all, this clip was recorded with epsilon at 0 and nothing changed :confused:

Before mentioned topic: Gravity only affects camera when moving - Bugs - Babylon.js
Clip:

Note: babylonjs debugger records to webm but the forum only allows mp4? xD

Pinging @RaananW but please provide a PG

1 Like

I was trying to do that but was having a hard time importing noise file to playground.
Finally did it, it will throw an error when loading PG but if you hit run it will work!
PG: https://playground.babylonjs.com/#78TPBB#8

So! quickly fixed the run issue - https://playground.babylonjs.com/#78TPBB#9 (async createFunction), I will look into the issue itself very soon :slight_smile:

1 Like

A better version with the correct way to use engine’s collisionEpsilon:

https://playground.babylonjs.com/#78TPBB#12

I also increase (a lot) the camera’s ellipsoid. The collision detection was programmed with steps in mind, and as this slope is very steam it takes it as a stair. In this case it requires the “stair” to have a maximum height relative to the camera’s ellipsoid, and this is why this demo works. I will see if I can find some configuration value that will allow you to set it dynamically instead of having it fixed in the code. I need to dig a bit :slight_smile:

1 Like

Ok, thanks for spending your time helping me :slight_smile:
If you find something please let me know, in the meanwhile i will try to make the slope less steam as a workaround because i really didn’t want the camera ellipsoid so big xD

You can also play with the gravity - https://playground.babylonjs.com/#78TPBB#13

1 Like

That works great! I changed it to -0.5 and it behaves just like i wanted!
Thank you very much :slight_smile:

1 Like