Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Climb animation is glitchy and isnt working properly

$
0
0
I have my first person controller approach a wall. When i sprint and collide i want the character to climb animation. It works and plays the animation but it plays it in the wrong spot, not relative where the player is. Please help. This is the script: var touchingWall : boolean = false; var isSprinting : boolean = false; var isClimbing : boolean = false; var playerObject : GameObject; function Update () { varControl (); climbing (); } function varControl () { if (Input.GetAxis("Vertical") && Input.GetButton("Sprint")) { isSprinting = true; }else{ isSprinting = false; } } function OnControllerColliderHit(hit : ControllerColliderHit) { if (hit.gameObject.tag == "climbable") { touchingWall = true; }else{ touchingWall = false; } if (hit.gameObject.tag == "climbend") { isClimbing = false; } if (touchingWall && isSprinting) isClimbing = true; } function climbing () { if (isClimbing) playerObject.animation.CrossFade("ClimbAnimation", 0.4); }

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>