- Home /
Missed key input
I am using a xbox controller. In the code I have Update listening for key input and the code to move the rigid body in FixedUpdate. When the A key is pushed it sets the state to jump. FixedUpdate switches on the state and performs the jump function. This is causing the jump to register only occasionally. It seems like the state is reset because Update is so much faster than FixedUpdate. It works great if I put all the code in Update but I know RigidBody should be moved from fixed update to ensure consistent physics if the frame rate changes. How should I handle this?
Answer by Bunny83 · Nov 28, 2017 at 02:30 AM
No, it seems almost everybody gets the point of FixedUpdate wrong. The only time when you need / should use FixedUpdate is when you want to apply a continous force. It doesn't matter where or when you apply one-time impulses. Even when it doesn't take immediate effect there's no problem applying a jump impulse in Update.
Good to know. I did have that wrong. I thought all rigid body movement was supposed to happen there. That makes this easier then
Your answer
Follow this Question
Related Questions
W key is unresponsive with input 1 Answer
Multiple Cars not working 1 Answer
Why Do Inputs Have to Been in Update (Rather than FixedUpdate)? 3 Answers
Distribute terrain in zones 3 Answers
Double tap mechanics and axis inputs 3 Answers