- Home /
Crouch and Slide FPS Character Controller
I was wondering if someone had perhaps made a crouch and slide script for the FPS Character that comes with the unity standard assets, that I would be able to just copy and paste? I have 0 coding knowledge and don't know how to do it myself, thanks for any and all help.
If you have 0 coding knowledge, to be frank, go get some. Because if someone hands you code that you copy + paste, that you dont understand, in the future, you're going to be re-using this wizardry/magic that fell out from the sky and if it causes issues, you're going to end up in the same cycle. Asking for help on the same issue, without taking a crack at it yourself.
Anyways, to help you out: $$anonymous$$aybe change the y position of the camera on button press (crouching to make you look smaller) and set running to true (to imitate sliding).
yeah I'm still learning. that's the main reason i was asking, I'm not planning on being lazy, i just wanted something i could maybe take apart and use for reference, as well as a quick fix
also yea that could work, but what i was thinking was you would go in one direction only for a small duration of time, being able to change camera facing direction, and being able to cancel the slide somehow, but not being able to change the sliding direction. thanks for the response btw.
Answer by arvindchetu · Oct 28, 2020 at 01:17 PM
Try this:-
Private void Update() {
if( Input.GetKeyDown(KeyCode.A)) {
animation.CrossFade("crouch", 0.5f);
}
else if( Input.GetKeyUp(KeyCode.A)){
animation.CrossFade("idle", 0.5f);
}
You can learn basic “Animation controlling techniques through scripts” over here… https://learn.unity.com/tutorial/controlling-animation
Answer by CallanCaustic · Oct 29, 2020 at 07:23 AM
@arvindchetu didn't seem to do anything. are you sure that's for the First Person controller? not the Third Person Controller?
Your answer
![](https://koobas.hobune.stream/wayback/20220613014618im_/https://answers.unity.com/themes/thub/images/avi.jpg)