- Home /
Why can't Animation run functions with Rigidbody.AddForce?
Hello,
I'm trying to use Animation Component to call certain functions in my script.
I know that the function is being ran because it shows up being called on the Console if i put print("ran"), but for some reason the Rigidbody AddForce code isn't running.
function Jump(){
rigidbody.AddForce(Vector3.up*10, ForceMode.Impulse);
print("jump called");
jumping = true;
}
Even if I insert this into the FixedUpdate() function it doesn't work, when I go to the editor and checkmark jumpNow variable to true...
function FixedUpdate ()
{
if(jumpNow == true){
Jump();
}
}
Any enlightenment on this subject would be most helpful, I'm pretty sure I'm missing something basic or doing something a bit incorrectly.
Thank you!
try
rigidbody.AddForce(Vector3.up * 1000, Force$$anonymous$$ode.Impulse);
just to check if the force may be not powerful enough to push the rigidbody.
Answer by Kaji-Atsushi · Jun 11, 2013 at 05:47 PM
After knowing the answer to this, I don't know if this qualifies as a question in the first place, since it's just one of those darn painful simple mistakes but.
Remember to checkmark "Animate Physics" in the animation component window. -.-
Your answer
Follow this Question
Related Questions
How to add physics to an animation? 3 Answers
rigidbody jumping and moving with constant speed without acceleration (with video ) 2 Answers
Apply force then slowly back off 4 Answers
Hovercraft Physics Problems 1 Answer
Light bulb moving HELP 1 Answer