- Home /
AddExplosionForce after FixedUpdate?
This question is about understanding the order of explosion forces applied and FixedUpdate steps executed, which is not documented anywhere.
I have a game where I push a rigidbody around with explosion forces. Under some circumstances I want to remove the force in on the x axis. I tried 3 different approaches to accomplish this:
Call AddExplosionForce and set rigidbody.velocity.x to 0 one line after it Didn't work
Call AddExplosionForce, set a bool to true that is checked in FixedUpdate, where rigidbody.velocity.x is set to 0 Didn't work
Call AddExplosionForce, start a Coroutine that yields until WaitForFixedUpdate and THEN sets rigidbody.velocity.x to 0. Works
This leads me to the conclusion, that FixedUpdate is called before explosion forces are applied, which means, that one has to yield one step for code to execute upon those changes. Is that correct?
Your answer
![](https://koobas.hobune.stream/wayback/20220613172205im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Question about WaitForFixedUpdate() 1 Answer
Physics architecture. When first step after collision happens? 0 Answers
Character won't move (Fixed) 1 Answer
Convert from m/s to m/fixedFrame 1 Answer