- Home /
 
rigidbody.AddForce not working when Animator is attached?
Hey guys, so I currently have for my script a simply upward jump script, as shown below.
 if (Input.GetKeyDown(KeyCode.Space)) {
     rigidbody.AddForce(Vector3.up * jumpPower, ForceMode.VelocityChange);
 }
 
               Worked great for my character for the time being. Then I decided to use Unity-Chan so I could have some practice with an Animator. When I attached the animator, the jump code suddenly stopped working. I did a search online and found that I may have to set the "Update Mode" in the Animator to "Animate Physics," but even after setting it up, my rigidbody function still didn't work. However, if I disable the animator, the rigidbody function works once more. Any ideas on how to fix this?
tl,dr: rigidbody.AddForce works before Animator is attached, and when Animator is disabled, but not when Animator is enabled, or when Animator is enabled and "Animate Physics" is checked.
Answer by thecomediclife · Oct 26, 2014 at 11:12 PM
Nevermind, it appears I found the answer. I un-checked the box marked "Apply Root Motion," which ended up fixing my script. I'm not too sure as to how or why this fixed it though... if someone could clarify that for me.
Answer by Naxionman1978 · Nov 28, 2019 at 07:49 PM
Hey there, I have the same problem. Without the animator attached or enabled, AddForce and AddTorque work well. However when I enable the animator and uncheck Apply Root Motion, I cannot control the player (no input at all). Have you found the answer to your question? I think it may help with my problem as well.
Your answer
 
             Follow this Question
Related Questions
cant add force to my player 1 Answer
How to make my bullets spread when fired 3 Answers
rolling ball movement on different axis 0 Answers
Trajectory problem with addforce coordinates 1 Answer
AddForce at Local ?? 2 Answers