Skip to content

YaCameraAPI

YaCameraAPI adjusts the player's camera. Before you apply this API, make sure you attach any of the following community components to objects in the scene.
  • Setting_CameraFixPositionAndOrientation
  • Setting_CameraFixPositionAndViewControllable
  • Setting_CameraFixPositionAndLookAt
  • Setting_CameraTopdown. With this component, the SetCameraPosition and SetCameraOrientation functions are unavailable.
  • Setting_CameraRTS
  • Setting_CameraSideScroll. With this component, the SetCameraPosition and SetCameraOrientation functions are unavailable.
  • Setting_CameraThirdPerson. With this component, the SetCameraPosition function is unavailable.

Functions

void YaCameraAPI.SetCameraOrientation(YaEntity targetPlayer, float3 orientation)

DEPRECATED 
Sets the camera rotation in Euler angles in degrees. Cannot be set with the FixedPositionAndLookAt component.
  • targetPlayer The target player
  • orientation The direction that the player faces

void YaCameraAPI.SetCameraOrientation(YaEntity targetPlayer, float3 orientation, YaCameraOrientationFlags cameraOrientationFlags)

DEPRECATED 
Sets the camera rotation in Euler angles in degrees. Cannot be set with the FixedPositionAndLookAt component.
  • targetPlayer The player entity or avatar entity that player is controlling
  • orientation The direction that the camera faces
  • cameraOrientationFlags Which axis will be considered in this call.Ignored axis value will use camera's relevant original value.

void YaCameraAPI.SetCameraPosition(YaEntity targetPlayer, float3 position)

DEPRECATED 
Sets the camera position. Cannot be set with the ThirdPerson, SideScroll, or TopDown component.
  • targetPlayer The player entity or avatar entity that player is controlling
  • position The position where camera should locates at

void YaCameraAPI.SetCameraDistance(YaEntity targetPlayer, number distance)

DEPRECATED 
Sets the amount of extra distance between camera and target. Cannot be set with the FixPositionAndOrientation, FixPositionAndLookAt, FixPositionAndViewControllable component.
  • targetPlayer The player entity or avatar entity that player is controlling
  • distance The distance

void YaCameraAPI.SetCameraFollowAt(YaEntity targetPlayer, YaEntity followTarget)

DEPRECATED 
Sets the target for the camera to follow.
  • targetPlayer The player entity or avatar entity that player is controlling
  • followTarget The target that camera follows

void YaCameraAPI.SetCameraLookAt(YaEntity targetPlayer, YaEntity lookAtTarget)

DEPRECATED 
Sets the target for the camera to look at.
  • targetPlayer The player entity or avatar entity that player is controlling
  • lookAtTarget The target that camera looks at

void YaCameraAPI.SetCameraControllable(YaEntity targetPlayer, boolean controllable)

DEPRECATED 
Determines if the camera view is controllable.
  • targetPlayer The player entity or avatar entity that player is controlling
  • controllable If true, the camera view and zoom in is controllable; if false, the camera view and zoom in is uncontrollable.

void YaCameraAPI.SetCameraFov(YaEntity targetPlayer, number fov)

DEPRECATED 
Clamps the camera's field of view (FOV) value between 1 and 179.
  • targetPlayer The player entity or avatar entity that player is controlling
  • fov The field of view of the camera

void YaCameraAPI.SetCameraSensitivity(YaEntity targetPlayer, number sensitivity)

DEPRECATED 
If the camera view is controllable, use this API to adjust the speed of the camera.
  • targetPlayer The player entity or avatar entity that player is controlling
  • sensitivity The speed of the camera movement

void YaCameraAPI.SetCameraNearFarClippingPlane(YaEntity targetPlayer, float2 nearFarClippingPlane)

DEPRECATED 
Adjusts the near and far plane of the camera's viewing frustum.
  • targetPlayer The player entity or avatar entity that player is controlling
  • nearFarClippingPlane The near and far clipping plane of the camera's viewing frustum. Recommended near clipping plane value: 0.2. The far clipping plane should not be too close to the camera as any objects further away from the camera than the far clipping plane isn't displayed.

void YaCameraAPI.SetCameraRestore(YaEntity targetPlayer)

DEPRECATED 
Restores initial camera settings.
  • targetPlayer The player entity or avatar entity that player is controlling

YaPostProcessBloomHandle YaCameraAPI.InstanceBloomHandle(YaEntity targetPlayer)

ReturnsPost process bloom handle
Camera play post process bloom on target player
  • targetPlayer player entity or avatar entity
1
2
3
4
5
local handle = YaCameraAPI.InstanceBloomHandle(script:SelfEntity())
handle.Color = float3.New(0.26, 0.1, 0.24)
handle.Intensity = 0.4
handle:Play()
-- if want to stop post process, call handle:Stop()

YaPostProcessBloomHandle YaCameraAPI.InstanceBloomHandleGlobal()

ReturnsPost process bloom handle
Camera play post process bloom on all entities
1
2
3
4
5
local handle = YaCameraAPI.InstanceBloomHandleGlobal()
handle.Color = float3.New(0.26, 0.1, 0.24)
handle.Intensity = 0.4
handle:Play()
-- if want to stop post process, call handle:Stop()

YaPostProcessColorAdjustHandle YaCameraAPI.InstanceColorAdjustHandle(YaEntity targetPlayer)

ReturnsPost process color adjust handle
Camera play post process color adjust on target player
  • targetPlayer player entity or avatar entity
1
2
3
4
5
6
local handle = YaCameraAPI.InstanceColorAdjustHandle(script:SelfEntity())
handle.PostExposure = 1
handle.Contrast = 100
handle.ColorFilter = float3.New(0.5, 0.35, 0.35)
handle:Play()
-- if want to stop post process, call handle:Stop()

YaPostProcessColorAdjustHandle YaCameraAPI.InstanceColorAdjustHandleGlobal()

ReturnsPost process color adjust handle
Camera play post process color adjust on all entities
1
2
3
4
5
6
local handle = YaCameraAPI.InstanceColorAdjustHandleGlobal()
handle.PostExposure = 1
handle.Contrast = 100
handle.ColorFilter = float3.New(0.5, 0.35, 0.35)
handle:Play()
-- if want to stop post process, call handle:Stop()

YaPostProcessVignetteHandle YaCameraAPI.InstanceVignetteHandle(YaEntity targetPlayer)

ReturnsPost process color adjust handle
Camera play post process vignette on target player
  • targetPlayer player entity or avatar entity
1
2
3
4
local handle = YaCameraAPI.InstanceVignetteHandle(script:SelfEntity())
handle.Intensity = 0.572
handle:Play()
-- if want to stop post process, call handle:Stop()

YaPostProcessVignetteHandle YaCameraAPI.InstanceVignetteHandleGlobal()

ReturnsPost process color adjust handle
Camera play post process vignette on all entities
1
2
3
4
local handle = YaCameraAPI.InstanceVignetteHandleGlobal()
handle.Intensity = 0.572
handle:Play()
-- if want to stop post process, call handle:Stop()