Hi all. i have a question for my rpg game.
If i use Third person camera, and the charater are example in wall.
The player can see behind wall.
how can I avoid that the camera does not pass through the wall?
Hi all. i have a question for my rpg game.
If i use Third person camera, and the charater are example in wall.
The player can see behind wall.
how can I avoid that the camera does not pass through the wall?
Use collision detection. You’ll raycast back from the player. If the raycast hits something (like a wall), you need to move the camera in front of the point of collision.
Some examples already exist on the Unity wiki:
http://wiki.unity3d.com/index.php/Scripts/Controllers
http://wiki.unity3d.com/index.php/SmoothFollowWithCameraBumper
Here’s 3DBuzz’s comprehensive tutorial: