YaVirtualCameraAPI
The
YaVirtualCameraAPI static class provides functionality to adjust the player's virtual camera in a game scene.Functions
float2 YaVirtualCameraAPI.ScreenResolution()
CLIENT ONLY
Returnsthe screen resolution
Gets the screen resolution. It is represented as (pixelWidth, pixelHeight) in pixels.float2 YaVirtualCameraAPI.GetScreenSize()
CLIENT ONLY
Returnsthe screen size
Gets the screen size. It is usually represented as (Width, Height) in world size.float3 YaVirtualCameraAPI.WorldToScreenPoint(float3 worldPoint)
CLIENT ONLY
Returnsthe screen position
Converts a position from world space to screen space
Screen space is a 2D coordinate system defined by the dimensions of a display.
The bottom left corner of the screen space is (0,0), and the top right corner is (pixelWidth, pixelHeight) in pixels.
The z position of objects in 3D space can be represented in screen space using a depth value relative to the camera.worldPointThe world position to be converted
float3 YaVirtualCameraAPI.WorldToViewportPoint(float3 worldPoint)
CLIENT ONLY
ReturnsThe viewport position
Converts a position from world space to viewport space
Viewport space is normalized and relative to the camera. The bottom left corner corner of the viewport space is (0,0), and the top right corner is (1, 1).
The z position of objects in 3D space can be represented in viewport space using a depth value relative to the camera.worldPointThe world position to be converted
float3 YaVirtualCameraAPI.ViewportToWorldPoint(float3 viewport)
CLIENT ONLY
ReturnsThe world position
Converts a position from viewport space to world space
Viewport space is normalized and relative to the camera. The bottom left corner corner of the viewport space is (0,0), and the top right corner is (1, 1).
The z position of objects in 3D space can be represented in viewport space using a depth value relative to the camera.viewportThe viewport position to be converted
float3 YaVirtualCameraAPI.ScreenToWorldPoint(float3 screen)
CLIENT ONLY
ReturnsThe world position
Converts a position from screen space to world space
Screen space is a 2D coordinate system defined by the dimensions of a display.
The bottom left corner of the screen space is (0,0), and the top right corner is (pixelWidth, pixelHeight) in pixels.
The z position of objects in 3D space can be represented in screen space using a depth value relative to the camera.screenThe screen position to be converted
YaRay YaVirtualCameraAPI.ScreenPointToRay(float3 screen)
CLIENT ONLY
ReturnsThe camera ray with the origin point and direction indicated
Returns a ray going from the camera and passing through a specified point in screen space
The resulting ray commences at the near plane of the camera and extends through the pixel coordinates (x, y) on the screen, ignoring the position.z value.
Screen space is represented by pixels. The bottom left corner in screen space is (0, 0), and the top right corner is (pixelWidth - 1, pixelHeight - 1).screenA 3D point in screen space. The position.z value will be ignored.
float3 YaVirtualCameraAPI.GetCameraPositionFromServer(YaEntity targetPlayer)
SERVER ONLY
Returnsposition
Gets the current position of the virtual camera being used by the specified player entity or avatar entity that the player is controlling
The position value is calculated based on the previous frame.targetPlayerThe player entity or avatar entity that player is controlling
float3 YaVirtualCameraAPI.GetCameraEulerFromServer(YaEntity targetPlayer)
SERVER ONLY
Returnsthe camera's rotation as Euler angles
Gets the target player's virtual camera's rotation as Euler angles in degrees
The rotation value is calculated based on the previous frame.targetPlayerThe player entity or avatar entity that player is controlling
void YaVirtualCameraAPI.SetCameraDamping(float3 dampingXYZ)
CLIENT ONLY
Sets the current virtual camera damping values for its x-, y-, and z- axes. Only works when you use a third-person virtual camera.
dampingXYZThe damping values for the camera's x-, y-, and z- axes
float3 YaVirtualCameraAPI.GetCameraDamping()
CLIENT ONLY
Returnsthe damping values for the camera's x-, y-, and z- axes
Gets current virtual camera's damping values for its x-, y-, and z- axesfloat3 YaVirtualCameraAPI.GetCameraEuler()
CLIENT ONLY
ReturnsThe camera's rotation as Euler angles
Gets the local player's current virtual camera's rotation as Euler angles in degrees
The rotation value is calculated based on the previous frame.void YaVirtualCameraAPI.SetCameraTransform(float3 position, float3 eulerAngle)
CLIENT ONLY
Sets the current virtual camera's position and rotation Only works when the camera has no tartget to look at or follow and view is not controllable.
positionThe camera's position in world spaceeulerAngleThe camera's rotation as Euler angles
void YaVirtualCameraAPI.SetCameraEuler(float3 eulerAngle)
CLIENT ONLY