- Home /
Why can't I use CharacterController and a BoxCollider simultaneously?
Here is the problem, I have a troop controlled by CharacterController
and I want the troop to block if collide with something. So I add a box collider to it. But it's not working, as the figure shows. The cube blocked the capsule collider of CharacterController
but not the box collider.
Answer by Jeff-Kesselman · Apr 30, 2014 at 02:14 PM
Because your object does not have a RigidBody.
Character controllers have their own physics implementation that conflicts with the standard physics
You can try adding a child object to the character, then add a RigidBody and a BoxCollider to the child. (I'm not sure if that works or not.)
If that doesn't work you are going to either have to get rid of the character controller or make the box collider a trigger and do your own blocking based on it.
But even if I specify the collider as a trigger, the behavior is strange. I add an GameObject as a child of the troop and attach a box collider on it, same as shown in the figure. I expect a OnTriggerEnter
at the first frame with the CharacterController
, but this happen until I move the troop for the first time, and OnTriggerStay
ever after. And I expect a OnTriggerEnter
event when the troop touch the cube, but nothing happens, the state is still OnTriggerStay
caused by the CharacterController
in the box collider.
And if I use a rigidbody
to move the troop, I don't want any physical behavior of it. For example, I will drag (on mobile devices) the troop on a path, and if the path is a circle, the troop will rotate because of a change of moving direction, and many other strange behavior which is good for a rigidbody but not for my players.
Finally I attach a kinematic rigidbody to my troop and keep the box collider and charactercontroller, now I can detect the collision and handle it myself. ref: link text
Your answer
![](https://koobas.hobune.stream/wayback/20220613143929im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Character's trigger collides with itself 2 Answers
CharacterController had no enabled property 1 Answer
Character Controller won't collide with anything 1 Answer
Equivalent to Character Controller for Quadrupeds 3 Answers
How to make collision with moving CharacterController and moving Collider. 1 Answer