Camera Perspective Gizmo
Send me a message for support
Unity Asset Store
Add a nice camera perspective gizmo similar to the gizmo in the Scene View of the Unity Editor to your game. Click on the axes to change camera's position and direction. Click on the cube in the middle to toggle between perspective and orthographic camera view.
This asset is Unity 5 ready!
In the example on the right, you can place the gizmo in one of the screen corners, change its size and choose one of two pivot points. You also can set the minimal distance between pivot and camera.
Documentation:The Camera Perspective Gizmo tool is part of the Multiplatform Runtime Level Editor also available on the Unity Asset Store.
Add a camera view control with six axis (+X,-X,+Y,-Y,+Z,-Z) and a view mode toggle (perspective, orthographic) with this single code line:
The camera perspective gizmo uses its own layer. The gizmo object is moved to this layer and rendered by its own camera. Disable the rendering of the gizmo layer in the inspector of your main camera. Alternatively, you can do this by code or move the gizmo object far away from your scene:
// Create gizmo for the main camera. This example expects that GIZMO_LAYER is an int constantCPG_CameraPerspectiveGizmo gizmo = CPG_CameraPerspectiveGizmo.Create(Camera.main, GIZMO_LAYER);
You can set the properties of the CPG_CameraPerspectiveGizmo prefab located in 'LapinerTools/CameraPerspectiveGizmo/Resources' or set the same properties via code using the object returned by CPG_CameraPerspectiveGizmo.Create.
// Hide the gizmo in your main camera since the gizmo is rendered with its own cameraCamera.main.cullingMask &= ~(1<<GIZMO_LAYER);
// Alternatively you can move the gizmo far away from the main cameram_gizmo.transform.position = Vector3.down*-10000f;
RelativeScreenPos (Vector2): center in relative screen coordinates [0-1].
RelativeScreenSize (float): size in relative screen coordinates [0-1].
LayerToUse (int): this layer will be used to render the gizmo (hide it in main camera).
Pivot (Vector3): this point will be focused when one of the axes is clicked. The camera should always look at this point to avoid camera jumps. Update it if you move the camera in your own code.
MinDistToPivot (float): camera will have at least this distance to the pivot point after the view axis is changed.
OrthoOffset (float): this offset will be applied when the camera mode is changed to orthographic. You might need it to avoid objects being clipped because of the near plane.
TargetCamera (Camera): camera which is managed by the gizmo.
Code does not compile. With errors like:
"error CS0246: The type or namespace name `CPG_CameraPerspectiveGizmo' could not be found. Are you missing a using directive or an assembly reference?"
To avoid conflicts with your code the tool has its own namespace. Add the namespace by placing this line at the top of your code file: