2
\$\begingroup\$

I am confused about the usage of static / not simulated rigidbodies.

I get that it is better to disable simulated to temporarily stop a rigidbody rather than deleting and recreating it, especially because all references wont get destroyed, but why are there two options to stop it? What is the difference between a static rigidbody and a not simulated rigidbody?

Also I have heard that peoplre create a lot of colliders with static/not simulated colliders. Why bother to create rigidbodies at all if the gameObject is never meant to move? Doesn't this just waste processing power to a thing that is completely unnecessary?

Edit: I am working in 2d, but same things should be occuring in 3d.

Here is the Rigidbody2D inspector for clarity:In the Body Type dropdown you can set RB to static, and you can mark it as not simulated. RB2D inspector

\$\endgroup\$
0

1 Answer 1

2
\$\begingroup\$

The main difference between a "Body Type: Static" and a "not simulated" Rigidbody2D is that a "Body Type: Static" Rigidbody2D still blocks the movement of other 2D rigidbodies, while a "not simulated" Rigidbody2D stops interacting with other objects completely.

So "static" is what you would use for an object that are supposed to behave as unmoving, solid parts of the level geometry. It will float in mid-air, but things can jump on them.

Now in that case you might wonder why you need a Rigidbody2D at all in this situation, considering that an object with a Collider2D but without a Rigidbody2D will also act like that. The difference is that this behavior of a collider can not be changed at runtime (unless you remove the Collider2D component), while the Body Type can. So when you have an object that needs to change between static and dynamic and/or kinematic behavior, you might want to give it a Rigidbody2D.

Switching off the "simulated" flag is used when you want to temporarily switch the Rigidbody2D of an object on and off completely. A not simulated Rigidbody2D will also float in mid-air, but other Rigidbody2Ds will go right through it. Possible use-cases are:

  • improve FPS by disabling physics for objects that are off-screen
  • when you have an object that has a "blocking" and a "non-blocking" state.
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .