PhysX 3.3 in Unity 5.6 & Unity 2017.1 Rigidbody vs “Static” Colliders…

Hey Unity – I have a question for you that won’t fit on Twitter, (at least not in the 128 characters they allow)!

I Googled and read numerous comments about colliders during runtime and their effects on performance. However I can’t seem to find a solid answer.

Unity defines a Static Collider as;

“A Static Collider is just a gameobject with a collider component on it, but without a Rigidbody component.”

The question is “Should Static Colliders also have a Rigidbody attached for performance reasons?”.

I know that before Unity 5 Rigidbodies were required on all Static Colliders to prevent PhysX from recalculating the batched colliders.

Then in Unity 5 there was discussion of that no longer being the case; that in Unity 5 the Static Collider no longer required a Rigidbody, (for performance).

When looking at the documents for Collider (Unity 2017.1) it states

“If the object with the Collider needs to be moved during gameplay then you should also attach a Rigidbody component to the object. The Rigidbody can be set to be kinematic if you don’t want the object to have physical interaction with other objects.”

However in Mike Geig’s  MerryFragmas 3.0 videos he states that the Rigidbody was a “remnant” – (6 minutes 32 seconds); making the Player Controller a Static Collider.

As I understand the Character_Controller component, it is a child of the Capsule Collider class, but I could be wrong on that.

Additionally Mike Geig added a second Collider to the Player Prefab in his training video.

Mike Geig’s comment is confirmed in the High Performance Physics in Unity 5 article;

“In Unity 5, we’ll use the same data structure to handle the movement of both dynamic and static colliders. Unfortunately, we’ll lose the benefit of Static Colliders consuming less memory than dynamic ones. However, right now, the cost associated with moving Static Colliders is one of the top 3 causes of performance issues in Unity games. We wanted to change that.”

So to set the record straight; will Colliders that are missing a Rigidbody component suffer from performance loss in Unity5 & Unity 2017?

“To Rigidbody or not to Rigidbody a Character Controller Component, that is my question.”



And Mike Geig says;

Answer by Mike-Geig 

“There is no performance difference between moving a collider with or without a rigidbody component. That was fixed in Unity 5.

Now, there is a reason why you may still want to put kinematic rigidbodies on your colliders that will move. Currently, “static” colliders (those without a rigidbody) won’t wake up a rigidbody object that happenings to be sleeping on it.

So, for example, if you have a ball fall and land on a platform. Once the ball comes to a rest, it falls “asleep” due to physics inactivity (to be more efficient). If the platform has a “static” collider and it moves, the ball won’t wake up and thus won’t move or fall. If the platform were to also have a rigidbody, the ball would be woken up and resume physics simulation.

In summary, no performance issues but could lead to behavior issues with other objects.”

Thank you Mike!