Lumberyard
User Guide (Version 1.15)

Camera

Component entity system is in preview release and is subject to change.

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

The Camera component has the following properties:

Field of View

Vertical field of view in degrees.

Valid values: 0 – 180

Default value: 75

Near Clip Plane Distance

Distance to the near clip plane of the view frustum in meters.

Default value: 0.2

Far Clip Plane Distance

Distance to the near far plane of the view frustum in meters.

Default value: 1024

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 about using the EBus interface, see Working with the Event Bus (EBus) System.

GetFov

Gets the current field of view.

SetFov

Sets the current field of view.

GetNearClipDistance

Gets the current near clip distance.

SetNearClipDistance

Sets the current near clip distance.

GetFarClipDistance

Gets the current far clip distance.

SetFarClipDistance

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