I'm trying to create a simple cover mechanic by using box colliders and checking for trigger events. As with all cover mechanics, I want to ensure that the player can not leave the bounds dictated by the box collider.
How would I go about ensuring the player (in this instance a character controller) does not leave the box colliders individual bounds?
asked Jul 25 '10 at 08:07 PM
There shouldn't be a problem. Character controllers do respond to collisions, otherwise they'd fall through floors and walk through walls.
If your colliders are set up correctly and are not simply triggers, the the character controller shouldn't move through them.
If they need to be triggers for some reason, though I'm not sure why that would be, you will have to write code that responds to the trigger by moving the player back to a spot inside the box. (Maybe the last spot they were at before the collision occurred.)
answered Jul 28 '10 at 07:52 PM