Version:

Camera

Camera

The Camera component allows an entity to be used as a camera. To use the Camera component, you must first add a Camera Framework gem to your project. For information, see Camera Framework Gem.

Camera Component Properties

[Camera component properties in the Entity Inspector.]

The Camera component has the following properties:


NameDescription
Field of viewVertical field of view in degrees. Valid values: 0 to 180 Default value: 75
Near clip distanceDistance to the near clip plane of the view frustum in meters. Default value: 0.2
Far clip distanceDistance to the near far plane of the view frustum in meters. Default value: 1024
Be this cameraEditor uses the selected camera as its view. For more information, see Changing the Camera View.
Frustum lengthLength of the frustum shape. Default value: 1.0 percent
Frustum colorColor of the frustum shape. Default value: 255, 255, 0

EBus Request Bus Interface

Use the following request functions with the event bus (EBus) interface, CameraRequestBus, to communicate with other components of your game.

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


Request NameDescription
GetFovGets the current field of view.
SetFovSets the current field of view.
GetNearClipDistanceGets the current near clip distance.
SetNearClipDistanceSets the current near clip distance.
GetFarClipDistanceGets the current far clip distance.
SetFarClipDistanceSets the current far clip distance.

The following is an example of script using the Request Bus Interface.

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

Creating 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.