I have a problem with detecting collisions between Box Collider and Character Controller.
Is there any way to detect the collision between them?
I have a problem with detecting collisions between Box Collider and Character Controller.
Is there any way to detect the collision between them?
You can only detect collisions if one of the objects involved has a rigidbody component added.
So, for example: Say you have a box (With rigidbody and box-collider) and a player (with a CharacterController) and you needed to know when the box collided with the player, you would use OnCollisionEnter() in a script attached to the box.
OR
If you needed to tell if the player collided with the box, you would use OnControllerColliderHit() in a script attached to the player.
You should set Box collider as trigger, so your character Controller can enter it,otherwise the character will stop at the specified boundary. Also your character should have a “rigidbody” component attached to it.
Create a empty gameobject then attach a box collider component to it, and create a script,
in your script define a function :
void OnTriggerEnter(Collider other){
print (other.name);
}