CameraComponent

Adds a camera function that faces an Entity. Use CameraService to switch between cameras.

# Properties

[{"index":"Vector2 CameraOffset","0":"Sets the position of the camera based on World coordinates."}]

[{"index":"boolean ConfineCameraArea","0":"Sets the camera to cover only the foothold area of the map."}]

[{"index":"Vector2 Damping","0":"Determines how quickly the camera responds when a subject enters the SoftZone while it is tracking the subject. The smaller the value, the more responsive it is."}]

[{"index":"Vector2 DeadZone","0":"Sets the DeadZone area, the section of the frame where the camera holds its target."}]

[{"index":"float DutchAngle","0":"Sets the rotation value of the camera."}]

[{"index":"boolean IsAllowZoomInOut","0":"The active camera is checked to see whether zoom operation is allowed."}]

[{"index":"Vector2 LeftBottom (Sync)","0":"The bottom-left value of the camera-restricted area."}]

[{"index":"string MaterialId (Sync)","0":"Specifies the Id of the material to be applied to the renderer."}]

[{"index":"Vector2 RightTop (Sync)","0":"The top-right value of the camera-restricted area."}]

[{"index":"Vector2 ScreenOffset","0":"The ratio value of the full screen based on the target. Values can be between 0 and 1; 0.5 will center the camera. Available when ConfineCameraArea is false."}]

[{"index":"Vector2 SoftZone","0":"Sets the SoftZone area. If target enters the frame area, the camera will shift direction to DeadZone."}]

[{"index":"boolean UseCustomBound (Sync)","0":"Shows whether you will directly define and use the camera-restricted area. You can define it using the LeftBottom and RightTop properties. When this is False, you will use the map area of the map where you belong. If the map area is the default, the corrected area based on that map area will be used as the camera-restricted area."}]

[{"index":"float ZoomRatio","0":"Sets the zoom ratio. The value must be set to ZoomRatioMin or greater and ZoomRationmax or less in percentage."}]

[{"index":"float ZoomRatioMax","0":"Sets the maximum value for the camera's zoom ratio. The value cannot exceed 500."}]

[{"index":"float ZoomRatioMin","0":"Sets the minimum value for the camera's zoom ratio. The value must be greater than 30."}]

##### inherited from Component:

[{"index":"boolean Enable (Sync)","0":"Checks whether Component is activated or not."}]

[{"index":"boolean EnableInHierarchy (ReadOnly) (HideFromInspector)","0":"Displays whether this Component is Enable in the hierarchy. If Entity Enable is false regardless of Component Enable, returns false."}]

[{"index":"Entity Entity (ReadOnly)","0":"The Entity that owns this component."}]

# Methods

[{"index":"void ChangeMaterial(string materialId)","0":"Replaces the material to be applied to the renderer."}]

[{"index":"Vector2, Vector2 GetBound()","0":"Gets the camera-restricted area composed of LeftBottom and RightTop."}]

[{"index":"void SetZoomTo(float percent, float duration, string targetUserId = nil) (Client)","0":"The camera will zoom in for the given amount of time (seconds)."}]

[{"index":"void ShakeCamera(float intensity, float duration, string targetUserId = nil) (Client)","0":"Vibrates the camera for a given amount of time (seconds)."}]

##### inherited from Component:

[{"index":"boolean IsClient()","0":"Returns whether the current execution environment is a client or not."}]

[{"index":"boolean IsServer()","0":"Returns whether the current execution environment is a server or not."}]

# Examples

This example sets the zoom factor to 300% after 4 seconds.
    
    
    @Component
    script DelayedCameraZoom extends Component
        @ExecSpace("ServerOnly")
        method void OnBeginPlay()
        local zoom = function()
            self.Entity.CameraComponent:SetZoomTo(300, 2)
        end
        _TimerService:SetTimerOnce(zoom, 4)
        end
    end
    

# SeeAlso

  * TimerService
  * [Controlling the Camera with CameraService](/docs?postId=118)