- Home /
 
 
               Question by 
               zinnfandel · Apr 02, 2011 at 12:00 AM · 
                animation2dphysicsforce  
              
 
              How to check force or velocity on character?
Hi!
I am making a 2D game and I want to change animations based on force tests. I have the jump working like this:
if(jump) 
    {
        rigidbody.AddForce(transform.up * jumpForce); 
        onGround = false; 
        jump = false;
    }
 
                
                
               And I want to animation to over-write other animations depending on the force up on the rigidbody. So if it is positive, make it a jumping up animation, and if it is negative make it a falling animation. Otherwise, other animation checks apply. So my character couldn't run in mid-air...
How do I go about doing that?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by e-bonneville · Apr 02, 2011 at 12:31 AM
Use rigidbody.velocity. In your case, you'd want rigidbody.velocity.y to get the falling speed. (Y is the up and down axis)
Your answer