Description
The FirstPersonCamera
method is a static extension method for the Gizmo.Instance
class, provided by the Editor.SceneEditorExtensions
class. This method is used to configure a first-person camera view within the scene editor. It allows the user to control the camera as if they are navigating the scene from a first-person perspective.
Usage
To use the FirstPersonCamera
method, you need to have a Gizmo.Instance
, a SceneCamera
, and a Widget
representing the canvas. You can also specify whether the cursor should be locked during the camera operation.
Here is how you can call this method:
bool result = gizmoInstance.FirstPersonCamera(sceneCamera, editorCanvas, lockCursor);
Where:
gizmoInstance
is an instance of Gizmo.Instance
.
sceneCamera
is the camera you want to control.
editorCanvas
is the canvas widget where the camera view is rendered.
lockCursor
is a boolean indicating whether the cursor should be locked to the canvas.
Example
// Example usage of FirstPersonCamera method
Gizmo.Instance gizmoInstance = new Gizmo.Instance();
SceneCamera sceneCamera = new SceneCamera();
Editor.Widget editorCanvas = new Editor.Widget();
bool lockCursor = true;
bool isCameraActive = gizmoInstance.FirstPersonCamera(sceneCamera, editorCanvas, lockCursor);
if (isCameraActive)
{
// The camera is successfully set to first-person mode
// Additional logic can be implemented here
}