- Home /
how to prevent fpc camera passing through trees?
i have a fpc controller which passes through the trees or hills or anything which comes in its way... I have tried to use capsule colliders on trees or other stuff but in vain... Plzz help
Answer by svenskefan · Dec 11, 2012 at 08:41 AM
Hi!
First of all, you need to figure out how you would want the camera to avoid going thru things. There is no one size fits all, and I guess possible solutions could be; raise the camera to let if float over any obstacle, move the camera sideways to avoid obstacles, combination of above, or any other method you could think of.
In all of the above methods, you need to figure out what is between the camera and the target. Enter Raycasts. By attaching colliders (preferably triggers) on possible obstructions, and continously raycasting from the camera towards the player, you can get an idea of what might be in the way.
Once you know what obstacles are in the way, you could tell the camera to avoid them....
Your answer
Follow this Question
Related Questions
Help with multi-purpose replacement shader for camera 1 Answer
Terrain Trees: Draw calls triples when FPS camera rotates? 0 Answers
Get mouse direction in locked 1 Answer
How to make camera position relative to a specific target. 1 Answer
How to hide Unity terrain trees when they are blocking the camera view? 0 Answers