- Home /
Showing/Visualizing the camera cone
Hey guys! Is there any way to show/visualize the cameras cone of view?
Answer by Julien-Lynge · Sep 30, 2011 at 11:27 PM
I take it you mean the camera view port, like you can see in scene view? Do you want to visualize it in game view? How do you want to do it - gizmo-type, or something that could display in the game itself (like an outline for a security camera)?
There's the quick and dirty way, which is to create a pyramid mesh in your favorite 3D program and add a mesh renderer to the camera's game object. Then you just adjust the scale of the mesh (assuming you set the mesh pivot to be at the top of the pyramid where the camera will be) until it exactly matches the camera's view area.
The fancier way is to turn each of the camera's corners (0,0 0,1 1,0 1,1) into a projected point in 3D space, with the z-distance being the value of the camera's far clip plane. Then you can do things like procedurally generate meshes or line renderers or do whatever you want to visualize the camera's constraints.
Good luck.
Answer by Bunny83 · Oct 01, 2011 at 01:35 AM
I guess you want something like this:
http://answers.unity3d.com/questions/143025/more-questions-on-generating-camera-frustrum.html