- Home /
Not colliding with a box collider?
I have a box collider attached to an object and my player with a transform.Translate script on the player. They do not collide. I added a Character Controller to the player and it still doesn't work. Is this something to do with transform.Translate, do I have to add something in script?
Answer by robertbu · May 16, 2014 at 01:07 AM
In order to prevent the player from walking through other objects, the player needs either a Rigidbody or a CharacterController. If it has a CharacterController, the player needs to be moved through CharacterController.Move() or CharacterController.MoveSimple(). Note a collision between a CharacterController and another object does not trigger an OnCollisionEnter() callback. To capture a collision between a CharacterController and another object, you must use OnControllerColliderHit() in a script on the CharacterController.
Note if you use a Rigidbody and use Translate, there is a chance that your player will pass through an object. Use Rigidbody.MovePosition() instead.
Answer by SparkySniper · May 16, 2014 at 01:03 AM
You might need a rigidbody attached to your player that is trying to collide.
Your answer
Follow this Question
Related Questions
Box collider with rigid body yet enemies still pass through each other. 1 Answer
Platform collision detection 3 Answers
Collision between Character Controller and Box Collider 2 Answers
Help in Javascript destroying Objects using character controllers and conditionals 1 Answer
CharacterController Collision causing teleportation? 1 Answer