Forum rules - please read before posting.

Running actionlist/custom script when player stops moving

Is there a function to check if the player is currently moving or has stopped movement? I want to have random custom idle animations running and so far got that working by switching the standard idle animation through action lists, but would like to get it back to the standard one when the player continues moving.

Comments

  • Oh, so far I found this AC.KickStarter.player.GetMoveSpeed(); and it seems to be doing what I need!

            float curspeed = AC.KickStarter.player.GetMoveSpeed();

            if (curspeed < 0 || curspeed > 0)
            {
                AC.KickStarter.player.idleAnim = clip; 
            }
  • All characters have a charState enum variable with Idle, Moving and Custom states:

    if (AC.KickStarter.player.charState == CharState.Idle)
    {
     //
    }

    Probably easier to use Mecanim animation if you want to alter the idle animation, as you can wire up your Animator component to play different animations based on e.g. an integer parameter.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.