YaCameraAPI¶
Beta
YaCameraAPI
adjusts a 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¶
Sets the camera orientation. Cannot be set with the FixedPositionAndLookAt, SideScroll, or TopDown component
targetPlayer
The player entity that owns the cameraorientation
The direction that the camera faces
Sets the camera's position. Cannot be set with the ThirdPerson, SideScroll, or TopDown component
targetPlayer
The player entity that owns the cameraposition
The camera's position
Sets the target for the camera to follow.
targetPlayer
The player entity that owns the camerafollowTarget
The camera target to follow
Sets the target for the camera to look at.
targetPlayer
The player entity that owns the cameralookAtTarget
The camera target to look at
Determines if the camera view is controllable
targetPlayer
The player entity that owns the cameracontrollable
If true, the camera view is controllable; if false, the camera view is uncontrollable. It can be set with the Third Person, FixPositionAndViewControllable, or RTS component.
Clamps the camera's field of view (FOV) value between 1 and 179
targetPlayer
The player entity that owns the camerafov
The field of view of the camera
If the camera view is controllable, use this API to adjust the speed of the camera.
targetPlayer
The player entity that owns the camerasensitivity
The speed of the camera movement
void YaCameraAPI.SetCameraNearFarClippingPlane(YaEntity targetPlayer, float2 nearFarClippingPlane)Beta
Adjusts the near and far plane of the camera's viewing frustum
targetPlayer
The player entity that owns the cameranearFarClippingPlane
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.
Restores initial camera settings.
To restore the initial camera status, call this API together with the SetCameraControllable API.