Walk animation is jumping back the null point.

Hi,

I need help for my first Unity game.
My model can walk, rotate and jump, but after last frame of animation, it is jumping back to null point and the walk isn’t continues. I exported the animated model from Maya.
I’m using U5.1.0f3
http://www.csongorfekete.com/app.html

Any answer will be helpful.

You probably have unneccsary keyframes on your root node. Translation ones moving it forwards in 3d space…
That and make sure your model is set to be humanoid and in the animations tab set to loop

Thank for your answer. I tried the rigged mode by humanoid, but I have problem with joints, and after choice I can’t walk.I need to remake the walk animation in Maya. Could you check again my demo and my script, because the movement with keys are wrong.

Thanks.

#pragma strict

var rotationSpeed : float = 10;
var walkSpeed : float = 7;
var gravity : float = -50;
private var yRot : float;
var body : Transform;

function Start () {

}

function Update () {
    var Controller : CharacterController = GetComponent(CharacterController);
    var vertical : Vector3 = transform.TransformDirection(Vector3.back);
    var horizontal : Vector3 = transform.TransformDirection(Vector3.left);
    var height : Vector3 = transform.TransformDirection(Vector3.up);
   
    if(Input.GetKeyDown("space")){
        Jump();
    }
   
    if(Input.GetAxis("Vertical") || Input.GetAxis("Horizontal")){
        GetComponent.<Animation>().CrossFade("Run", 0.1);
        GetComponent.<Animation>()["Run"].speed = walkSpeed/9;
        Controller.Move((vertical * (walkSpeed * Input.GetAxis("Vertical"))) * Time.deltaTime);
        Controller.Move((horizontal * (walkSpeed * Input.GetAxis("Horizontal"))) * Time.deltaTime);
    }else{
        GetComponent.<Animation>().CrossFade("Idle", 0.1);
    }
   
    if(Input.GetAxis("Mouse X")){
        yRot += 5 * Input.GetAxis("Mouse X");
    }
    transform.rotation = Quaternion.Euler(0, yRot, 0);
   
    Controller.Move(height * gravity * Time.deltaTime);   
}


function LateUpdate(){
  // Rotate the Character to match the direction he/she is going
  if(Input.GetAxis("Vertical") == 0){
    if(Input.GetAxis("Horizontal") > 0){
      body.localEulerAngles.y = 180;
    }else if(Input.GetAxis("Horizontal") < 0){
      body.localEulerAngles.y = 0;
    }
  }else if(Input.GetAxis("Vertical") > 0){
    if(Input.GetAxis("Horizontal") > 0){
      body.localEulerAngles.y = 135;
    }else if(Input.GetAxis("Horizontal") < 0){
      body.localEulerAngles.y = 45;
    }
  }else if(Input.GetAxis("Vertical") < 0){
    if(Input.GetAxis("Horizontal") == 0){
      body.localEulerAngles.y = -90;
    }else if(Input.GetAxis("Horizontal") > 0){
      body.localEulerAngles.y = -135;
    }else if(Input.GetAxis("Horizontal") < 0){
      body.localEulerAngles.y = -45;
    }
  }
}


    function Jump(){
        gravity = 10;
        yield WaitForSeconds(0.3);
        gravity = -50;
    }

No need to CrossFade. Set up a Blendtree for Navigation and just use H and V to control that. Make sure you have checked both Loop tickboxes in Animation Clip setup. Try to get away from the CharacterController as you will have to hack in collisions. Use a rigidbody controller instead.