Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity Standard Asset Movement

Discussion in 'Scripting' started by Zalosath, Jun 11, 2016.

  1. Zalosath

    Zalosath

    Joined:
    Sep 13, 2014
    Posts:
    671
    Hey, I was wondering if there is a Boolean that is set to true when the player is running or, has jumped. I would prefer if I didn't have to check for movement myself because I have several UI's that can stop you from moving and would prefer not to add it to that too.

    Anyway, is there a way, using standard assets, that I can check if a player is running or has jumped?
     
  2. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,738
    you really have to explain, how the player is moving, like are you using a navmeshagent, a rigidbody or a transform to move it.

    if its a rigidbody or a navmesh agent, you can simply check to see if the magnitude of the velocity vector is greater than a really small number to determine if it is moveing.
     
  3. Zalosath

    Zalosath

    Joined:
    Sep 13, 2014
    Posts:
    671
    I'm pretty sure I did... The title, and the post itself says Standard Assets. The default FPS character.
     
  4. passerbycmc

    passerbycmc

    Joined:
    Feb 12, 2015
    Posts:
    1,738
  5. Zalosath

    Zalosath

    Joined:
    Sep 13, 2014
    Posts:
    671
    Then again, if they jump off a cliff?
     
  6. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,731
    If they walk off a cliff, isGrounded will be false until they hit the ground below.

    Or can I infer from your previous posts that you want to know the difference between the play jumping off the cliff and just walking off it? If that's the case you are going to need to add some logic of your own to make the differentiation.