3rd person tank controls: jitter when walking down ramp

Hello Everyone,

I am creating 3rd person tank-style controls with the ability to jump (Roughly cobbled together and modified from various other playgrounds).

Here it is (WASD to move, Z to jump. Adjust camera with mouse):

Everything works fine, except there is a jitter when walking down ramps. Does anyone know how to fix it so movement is smooth?

I used intersectsMesh instead of rays for detecting standing on the floor because I want it to behave more realistically when people step off ledges. With a ray it seems like half the body clips through the platform.

Hello! I think the problem is that the tank doesn’t move parallel to the surface of the ramp, leading to this situation being repeated:

I quickly hacked it so the character starts perpendicular to the ramp and moves backwards parallel to it, and it goes down the ramp smoothly: tank controls with jumping and collisions | Babylon.js Playground (babylonjs.com)

2 Likes

Thank you! One question though. I think I can add something to make the player object match the rotation of the floor under them. That would work great for vehicles.

However it may look a little strange if it is a tall human character instead of a vehicle. For example when a person walks down a ramp they stay upright, not perpendicular to the ground.

Is there any way to do the smooth movement but not have rotation?

My end goal is old school Tomb Raider/Resident Evil style movement.

Hmmmm yeah this is a more complicated case :thinking: Maybe you can take a look at @satguru 's great Character Controller? ssatguru/BabylonJS-CharacterController: A CharacterController for BabylonJS (github.com) Unfortunately it’s not compatible with Babylon 5 yet, but it shouldn’t be too much work to update it.

That sounds good thanks!

1 Like