Vaulting Over Ledges

Hey all,

Im sure what im looking for is fairly simple but im stuffed if I know how to do it…I am fairly new to coding. Oh and can any scripts please be in javascript. I am also only using unity basic.

Now I want to edit the firstpersoncontroller so that when I run up to a wall holding a certain button and make contact with it I ‘vault’ over it. This would give the player a small boost of speed (brought back to normal by friction). Oh and the character needs to go up and over the wall (small jump action?)

It’ll probably be a box collider with a trigger event that I attach to walls you can ‘vault’.

Any help would be greately appreciated.


Riley Morse

Hey man this is possibly more complicated then you think.

You will need a character model with a vault animation and possibly a compund collider depending on how you do this. The compound collider is the methrod we used as then clearing the object was purley animation based. You will need a custom character motor / controller which uses a rigidbody for this to work.

I think you can roughly get the result you want using the stock character controller by adding an upwards force/transition and playing the vault animation. You may have to set the capsule collider to run down the z-axis as well depending on your animation.

Without a HumanIK solution you’re going to struggle to get really, really good looking results but you can fake quite a bit if you’re clever.

transform.position does not affect gravity/momentum.

I’d suggest using rigidbody.AddForce to do what you want to do. I assume your camera is your player since it is a first person game. Simply add the force to your camera in the direction you want the player to go to vault the wall.