- Home /
fall animation triggered via rigidbody velocity
hi guys i made this small script for jump animation this works well but im trying make a fall animation when my character starts falling i found here script with rigidbody velocity but it doesnt work
here is my script
var JoystickScript:Joystick;
var touchCount : int;
var jump:AnimationState;
function Start()
{
jump = animation["jump"];
jump.layer = 1;
jump.blendMode = AnimationBlendMode.Blend;
}
function Update () {
touchCount = JoystickScript.tapCount;
if (touchCount > 0){
animation.Play ("jump");
}
}
function FixedUpdate()
{
if(rigidbody.velocity.y < 0f)
{
Debug.Log("fall");
}
}
my character has rigidbody component and no collider, and his parent object has character controller
if i turn use gravity then still falling if i use is kinematic nothing happens
if there is another way to simply run the fall animation, please share your experience, thx
Could you be more specific? What do you mean by "it doesn't work"? What are you expecting to happen? What is actually happening?
Is your character set up with a rigidbody and this script attached? Is the character moving and falling correctly? Do you see the "fall" message in your log when this happens?
If your character is not falling at all, you should probably double check your setup against the Unity component manual to make sure things are set up correctly.
when I run game mode, console over and over again displays a message "fall". I have switched to use gravity when I use kinematic nothing happens, I imagine that, if my character jumps up in the moment when its speed turns and starts to fall down suddenly starts falling moment then display fall message
Your answer
Follow this Question
Related Questions
Animation State issue 2 Answers
Fall Damage 3 Answers
Jump without character controller?? 2 Answers