- Home /
CharacterController Component does not use the Physics Engine?
Hi!
I was playing around with the physics and a CharacterController component.
I raised the TimeManager Fixed Timestamp to it's maximum value (10). And also modified the values in the Physics Manager to have as low impact as possible. In theory, by my understanding on how Physics work in Unity, the precision should be waaaaay off at the moment, but moving the CharacterController through the Move function results in great precision and great performance.
How is this possible?
Thank you!
EDIT:
After some research I found that:
Rigidbody:
Done in FixedUpdate()
Uses Unity's full physics system. It can be used with physics forces/impulses, etc.
Slides down hills however, since friction doesn't seem to do much.
It's best suited for objects but doesn't have much control for players.
Works with OnCollision events
CharacterController:
Done in Update()
Does NOT use any physics whatsoever, 100% player controlled.
The collider itself can not be rotated in any way. It is always vertical.
Collides against objects, ONLY in the direction it's currently moving. If it is moving forward, it will NOT collide with things that hit it's back or side. If it is not moving, it will NOT collide with anything. If it's collider passes through an object (such as the object moving through it) it wll NO LONGER collide with that object.
Does not work with OnCollision events. Only works with OnControllerColliderHit() against objects it's currently moving into. Not for anything that collides into it.
In summary, if your gameplay is based only on your character's movement and your character's collision with other object (such as endless runners), it's best to use CharacterController because you will get rid of a lot of overhead from physics calculations while the collision detection has perfect precision.
Are you calling $$anonymous$$ove from within Update or FixedUpdate? CharacterController does not use a rigidbody (and as such, does not move along with other PhysX controlled rigidbodies), and will ins$$anonymous$$d move and perform custom collision checking whenever you call $$anonymous$$ove regardless of the Physics settings.
Try tossing a few rigidbody shapes around to verify that the Time$$anonymous$$anager settings are working on PhysX rigidbodies correctly.
Answer by merkaba48 · Jul 05, 2017 at 03:34 AM
Perhaps because the CharacterController is kinematic? This means it's controlled via script and serves as an obstacle to non-kinematic physics bodies; changing the physics precision will probably affect how it interacts with dynamic physics objects, but as its movement is controlled entirely by script, it's unaffected by precision changes.
I don't know if that's true, but you can easily test it. Throw in a bunch of dynamic cubes and see how they behave with high precision vs low precision if you run into them.