help with animations for character mesh

I’m trying to make my guy stop running (When he stops moving forward he runs in place)

How can i make him stop running forward in place and just stand there

Also is there any zombie (like limping and “drunk” Like code someone can give me)

Thanks :slight_smile:

Ps.Feel free to correct spelling errors

So you could do something like this (presuming your animation is called run):

You might need to create a new script with this in, put it on your character and remove the animation stuff from your other scripts.

  function Start()
  {
      animation["run"].enabled = true;
      animation["run"].weight = 0;
  }

  var lastPosition : Vector3;

  function Update()
  {
         var distance = (transform.position - lastPosition).magnitude / time.deltaTime;
         lastPosition = transform.position;
         animation["run"].weight = distance / 2; //Or some other number depending on how fast it moves
  }