Box collider attached to camera not working
I've got a game with a 3rd person overhead camera and levels generated from 3D "tiles." I'm trying to set up a system whereby the game camera recognizes the edge of the playable area for any given level, and stops when it's about to pan outside of it.
Here's my setup; on my camera, I have a box collider with the following settings:
My camera also contains a script with an OnCollisionEnter listener:
void OnCollisionEnter ( Collision collisionInfo ) {
Debug.Log( "Detected collision between camera and " + collisionInfo.collider.name );
Debug.Log( "There are " + collisionInfo.contacts.Length + " point(s) of contacts" );
Debug.Log( "Their relative velocity is " + collisionInfo.relativeVelocity );
}
In the level, meanwhile, I have four box colliders marking the outer bounds:
These five colliders are all on the layer CameraColliders, and the CameraColliders layer is set to collide only with itself in the Layer Collision Matrix in my project's Physics settings.
So what's the problem, you ask? Simple: the game isn't registering collisions between CamCollider and the level boundary colliders. I haven't the faintest clue why. Help?
Your answer
Follow this Question
Related Questions
Planetary Zoom and Camera Rotation system 0 Answers
Third person look around camera, jagged results 0 Answers
Acceleration into world frame of reference. 0 Answers
Camera changing Scene 1 Answer