- Home /
3rd Person Camera Geometry Navigation
I need some help figuring out how to make my third person camera navigate geometry to follow the player. I'm using the Mouse Orbit code for the camera at the moment (seen here http://wiki.unity3d.com/index.php?title=MouseOrbitImproved) but it's solution to this is simply to move the camera close to the character until there is nothing between the two. this works in a pinch, or in tight spaces, but say I have a wall in the middle of no where for whatever reason.
It makes more sense to me to have the camera rotate around the player until the wall is no longer in the way. or otherwise have the camera avoid the wall. Does anyone have any solutions or suggestions for this? I've considered raycasts, but I'm not even sure what direction to cast them in. Thanks!
Answer by sirival · Nov 25, 2012 at 04:52 PM
What I've done in the past and worked pretty reasonably was to cast a ray from the player towards the camera. If the ray hit an obstacle then I smoothly move the camera towards the intersection. That way the camera is always in front of obstacles walls etc. this might be a problem in tight corners but in any case you should design your levels in a way that the camera is not obstructed by lots of obstacles.
Thanks, but the Orbit code I'm using already does that. what I want the camera to do is move around geometry ins$$anonymous$$d of just zoo$$anonymous$$g in.
Then maybe the article about camera collision and avoidance here: http://gamecodermag.com/game-coder-mag-022012/ might help you out
Your answer
Follow this Question
Related Questions
3rd person camera view lock 2 Answers
Turning a character to match camera rotation 0 Answers
3rd Person Camera with fixed rotation 1 Answer
RTS Camera Rotation and Movement 0 Answers