- Home /
Climb animation is glitchy and isnt working properly
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);
}
It probably doesn't have anything to do with your script. I bet the origins of the two animations are different, and it's likely your jump animation that isn't where you expect it.
To check within Unity select the GameObject that contains the skinned mesh renderer before he initiates his jump and observe if it's position jumps with the animation. If it remains smooth then this is very likely the issue.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to export MMD model to Unity? 0 Answers
Need help with some OnTrigger Scripting 2 Answers
A node in a childnode? 1 Answer