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
targetPlayerThe player entity that owns the cameraorientationThe direction that the camera faces
Sets the camera's position. Cannot be set with the ThirdPerson, SideScroll, or TopDown component
targetPlayerThe player entity that owns the camerapositionThe camera's position
Sets the target for the camera to follow.
targetPlayerThe player entity that owns the camerafollowTargetThe camera target to follow
Sets the target for the camera to look at.
targetPlayerThe player entity that owns the cameralookAtTargetThe camera target to look at
Determines if the camera view is controllable
targetPlayerThe player entity that owns the cameracontrollableIf 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
targetPlayerThe player entity that owns the camerafovThe field of view of the camera
If the camera view is controllable, use this API to adjust the speed of the camera.
targetPlayerThe player entity that owns the camerasensitivityThe 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
targetPlayerThe player entity that owns the cameranearFarClippingPlaneThe 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.