Hi, I’ve seen a few posts on here asking how to set up a crouch / slide. I’ve been able to set a simple system today so I thought I would share my method, and you guys could improve your systems from that if you need.
Here is the link to a video showing the result
Here are the images you can follow.
Step 1: Set up a crouch
Set up a key to enable crouching. I personally like to toggle my crouch so I don’t have to hold down the key. The ‘doN’ and ‘Switch Int’ Allow me to do this.
Make sure you set up a variable to control your speed if you want the character to move slower when in a crouch. You can use max walk speed for that. I set a Is Crouching Variable to bring into my anim graph as a new locomotion state.
The important part here is to set the blue nodes called ‘crouch’ and ‘uncrouch’ this makes your character capsule smaller so you can fit into holes. If you don’t set this up, your collision will stay the same way as when you are standing. If all you want it to crouch, then you are done.
Step2: set up a slide.
This is a bit more complicated, but not much.
Here you need to make a custom event (mapped to what ever you like) mine is mapped to my dodge button where when you sprint, dodge turns into sliding.
Don’t get all confused with the extra conditions in the branches, i need those because I have attacks set up. You can see and anti spam set-up I made, I did this because if you press the roll button a lot, you will glitch and start flying LOL. Here also you will need to attach the ‘crouch’ node so that the character capsule is small enough to slide under obstacles. The way I set it up for sliding, I used an anim montage and I use a system for launching the character. You see this with the ‘launch force’ and ‘jump force’. those are two variable I use connected to my montage. I have a launch event with the variables that I can plug into an animation with a notify.
This is the launch character setup I use.
and how it is connected in the anim graph is pretty simple.
I hope this is clear enough. Its the first time I try to explain something on here.
You can ask me questions if things are not clear, I will try to answer the best I can.