Version:

Camera Component

The Camera component adds a camera to an entity.

Provider

Camera Gem

Camera properties

Camera component properties in the Entity Inspector.

PropertyDescriptionValuesDefault
Be this cameraChoose the Be this camera button to activate the camera’s view in the viewport. For more information, see Changing the Camera View.
OrthographicIf set to enabled, this camera will use an orthographic projection instead of a perspective projection. Objects will appear the same size, regardless of their distance from the camera.BooleanDisabled
Field of viewVertical field of view in degrees.0.0 - 180.075
Near clip distanceDistance to the near clip plane of the view frustum in meters. Must be less than Far clip distance.0.001 to Infinity0.2
Far clip distanceDistance to the near far plane of the view frustum in meters. Must be greater than Near clip distance.0.001 to Infinity1024
Make active camera on activationIf set to enabled, this camera will become the active render camera when the component activates.BooleanEnabled
Debug - Frustrum lengthLength of the frustum shape as a percentage of the Far clip distance.0.01 - 100.01.0
Debug - Frustrum colorColor of the frustum shape.Eight bits per channel color: 0-255255,255,0

CameraRequestBus

Request NameDescriptionParameterReturnScriptable
GetFarClipDistanceReturns the Far clip distance of the camera in meters.NoneFar Clip Distance: FloatYes
GetFovReturns the Field of view of the camera in degrees.NoneFOV: FloatYes
GetFovDegreesReturns the Field of view of the camera in degrees.NoneFOV: FloatYes
GetFovRadiansReturns the Field of view of the camera in radians.NoneFOV: FloatYes
GetNearClipDistanceReturns the Near clip distance of the camera in meters.NoneNear Clip Distance: FloatYes
GetOrthographicHalfWidthReturns the orthographic half-width of the camera.NoneHalf-Width: FloatYes
IsActiveViewReturns True if the camera is the current active view.NoneBooleanYes
IsOrthographicReturns True if the camera is set to use an orthographic perspective.NoneBooleanYes
MakeActiveViewSets the camera to be the active view.NoneNoneYes
SetFarClipDistanceSets the Far clip distance of the camera in meters.Far Clip Distance: FloatNoneYes
SetFovSets the Field of view of the camera in degrees.FOV: FloatNoneYes
SetFovDegreesSets the Field of view of the camera in degrees.FOV: FloatNoneYes
SetFovRadiansSets the Field of view of the camera in radians.FOV: FloatNoneYes
SetNearClipDistanceSets the Near clip distance of the camera in meters.Near Clip Distance: FloatNoneYes
SetOrthographicIf True, sets the camera to use an orthographic perspective.BooleanNoneYes
SetOrthographicHalfWidthSets the orthographic half-width of the camera.Half-Width: FloatNoneYes

CameraNotificationBus

Request NameDescriptionParameterReturnScriptable
OnActiveViewChangedNotifies listeners that a new camera has been made the active view.NoneEntityIdYes
OnCameraAddedNotifies listeners that a new camera is active in the level.NoneEntityIdYes
OnCameraRemovedNotifies listeners that a camera has been deactivated in the level.NoneEntityIdYes

CameraSystemRequestBus

Request NameDescriptionParameterReturnScriptable
GetActiveCameraReturns the EntityId of the active camera.NoneEntityIdYes

For more information, see Working with the Event Bus (EBus) system.

Example Lua script

The following is an example of Lua script using the CameraRequestBus.

local camerasample =
{
    Properties =
    {
    }
}

function camerasample:OnActivate()
    CameraRequestBus.Event.SetFov(self.entityId, 85)
    local nearClip = CameraRequestBus.Event.GetNearClipDistance(self.entityId)
    CameraRequestBus.Event.SetFarClipDistance(self.entityId, nearClip + 1024)
end

return camerasample

Create camera entity from view

You can create a static camera view from a specific entity by right-clicking an entity in the viewport and choosing Create camera entity from view. This places a new entity with a camera component at the same point. You can adjust the view of the camera by modifying its transform component.