somewhere in the reference it says: "You should never move a Static Collider on a frame by frame basis. Moving Static Colliders will cause an internal recomputation in PhysX that is quite expensive and which will result in a big drop in performance. On top of that the behaviour of waking up other Rigidbodies based on a Static Collider is undefined, and moving Static Colliders will not apply friction to Rigidbodies that touch it. Instead, Colliders that move should always be Kinematic Rigidbodies."
A character controller is derived from a collider, So is that mean I should always attach a kinematic rigidbody to the character controller?
asked Apr 11, 2011 at 08:59 AM
answered Apr 11, 2011 at 09:09 AM
I tend to disagree and say "No".
The character controller (CC) - at least as implemented in PhysX, that is a kinematic CC - is a very specific piece of code working alongside (but outside of) the main physics simulation (rigid body dynamics). Although the CC do use a capsule collider, the collision is typically performed "by hand" in the CC code rather than automatically through the physics simulation like other colliders.
The remark about a kinematic rigid body being needed with a collider when you move the collider (i.e. change the transform directly, instead of applying forces to a rigid body) is mainly directed at other objects like a moving platform you would have in a typical platformer game. Indeed in this case the collider is by default part of the single "static" rigid body implicitly created by Unity to model all static objects in the simulation. So if you move it you invalidate the collision cache of all those objects at once, hence the performance warning. But in the case of the CC the collider is not part of the simulation, and is merely used as a data structure to remember the shape of the collision the CC has to take into account into its own specific collision routine.
I may be wrong about all this, as I am quite new to Unity. However I do know well about physics engines in general, and have written my own CC and physics engine, as long as studied the code of Bullet Physics (another physics engine competing with PhysX) and the CC of Doom3. If anybody has more insight about the actual Unity implementation please feel free to correct me.