I am working on a 3D Platformer in Unity3D and I need to prevent the player from going through walls. The movement for my player works like this:
(A bird-eye-view representation)The areas the player can move a divided into layers. He can slide into the 2nd, 1st , or 3rd layers. The player is not a rigid-body, and is controlled using a character controller. To move the player into these layers I simply increase his Z-Axis. Currently if my player is behind the wall he will slide directly into it. How can I determine if there is a wall to the left of the player in Unity 3D? If so, I simply wont allow the user to move to the layer until they have steered clear of the obstacle. Does anyone have any suggestions of what I should do?