YaVirtualCameraAPI
YaVirtualCameraAPI static class provides functionality to adjust the player's virtual camera in a game scene.Functions
float2 YaVirtualCameraAPI.ScreenResolution()
float2 YaVirtualCameraAPI.GetScreenSize()
float3 YaVirtualCameraAPI.WorldToScreenPoint(float3 worldPoint)
worldPointThe world position to be converted
float3 YaVirtualCameraAPI.WorldToViewportPoint(float3 worldPoint)
worldPointThe world position to be converted
float3 YaVirtualCameraAPI.ViewportToWorldPoint(float3 viewport)
viewportThe viewport position to be converted
float3 YaVirtualCameraAPI.ScreenToWorldPoint(float3 screen)
screenThe screen position to be converted
YaRay YaVirtualCameraAPI.ScreenPointToRay(float3 screen)
screenA 3D point in screen space. The position.z value will be ignored.
float3 YaVirtualCameraAPI.GetCameraPositionFromServer(YaEntity targetPlayer)
targetPlayerThe player entity or avatar entity that player is controlling
float3 YaVirtualCameraAPI.GetCameraEulerFromServer(YaEntity targetPlayer)
targetPlayerThe player entity or avatar entity that player is controlling
void YaVirtualCameraAPI.SetCameraDamping(float3 dampingXYZ)
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()
float3 YaVirtualCameraAPI.GetCameraEuler()
void YaVirtualCameraAPI.SetCameraTransform(float3 position, float3 eulerAngle)
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)
Sets the current virtual camera's rotation in world space as Euler angles Only works when the virtual camera has no target to look at and view is not controllable. Note that when you use a third person virtual camera and have a target to follow, changing the virtual camera's rotation via this API will affect its position. To avoid such effect, use SetCameraTransform instead.
eulerAngleThe camera's rotation as Euler angles
float3 YaVirtualCameraAPI.GetCameraEulerOffset()
void YaVirtualCameraAPI.SetCameraEulerOffset(float3 eulerAngleOffset)
Sets the rotational offset of the current virtual camera in camera space, which represents the difference between the camera's actual rotation in world space and its desired rotation. Camera space is the coordinate system where the camera is positioned at the origin(0,0,0), and objects are rendered relative to the camera's viewpoint.
eulerAngleOffsetThe rotational offset in camera space
float3 YaVirtualCameraAPI.GetCameraPosition()
float3 YaVirtualCameraAPI.GetCameraOffset()
void YaVirtualCameraAPI.SetCameraOffset(float3 offset)
Sets the offset of the current virtual camera from its target in camera space Camera space is the coordinate system where the camera is positioned at the origin(0,0,0), and objects are rendered relative to the camera's viewpoint.
offsetThe camera offset from target in camera space
void YaVirtualCameraAPI.SetCameraPosition(float3 position)
Sets the position of the current virtual camera in world space Only works when the camera has no target to look at or follow and view is not controllable.
positionThe position to set the camera to in world space
void YaVirtualCameraAPI.SetCameraFollowTarget(YaEntity entity)
Sets the target for the current virtual camera to follow. This method will not take effect in the Fixed camera mode.
entityThe target for the camera to follow
void YaVirtualCameraAPI.SetCameraLookAtTarget(YaEntity entity)
Sets the target for the current virtual camera to look at.
entityThe target for the camera to look at
void YaVirtualCameraAPI.SetCameraLookAtOffset(float3 lookAtOffset)
Sets the offset for the current virtual camera's target to look at, adjusting its position relative to the camera in the target's local space.
lookAtOffsetThe offset to set in the local space of the target for the camera to look at
void YaVirtualCameraAPI.SetCameraDistance(number distance)
Sets the distance for the current virtual camera to move along the z-axis. Only works when you use a third-person, sidescroll, rts, or topdown camera. If the specified distance exceeds the set distance interval, the specified distance will take effect.
distanceThe distance to set along the z-axis
void YaVirtualCameraAPI.SetCameraOrthographicSize(number size)
Changes the orthographic size of the current virtual camera
sizeThe new orthographic size to set for the camera
number YaVirtualCameraAPI.GetCameraOrthographicSize()
void YaVirtualCameraAPI.SetCameraViewControllable(boolean controllable)
Determines if the current virtual camera view is controllable.
controllableIf true, the camera view is controllable; if false, the camera view is uncontrollable. It can be set with the Third Person, FixPositionAndViewControllable, or RTS\SideScroll\TopDown component.
void YaVirtualCameraAPI.SetCameraZoomControllable(boolean controllable)
Determines if the current virtual camera zoom is controllable.Fix Mode will not effect.
controllableIf true, the camera zoom in out is controllable
number YaVirtualCameraAPI.GetFov()
void YaVirtualCameraAPI.SetFov(number fov)
Sets the current virtual camera's field of view (FOV) value. The FOV must be between 1 and 179 degrees. If a value higher than 179 is specified, the FOV will be clamped to 179. If a value smaller than 1 is specified, the FOV will be clamped to 1.
fovThe field of view of the camera in degrees
float2 YaVirtualCameraAPI.GetNearFarClippingPlane()
void YaVirtualCameraAPI.SetNearFarClippingPlane(number nearPlane, number farPlane)
Adjusts the near and far plane of the current virtual camera's viewing frustum.
nearPlanenearest distance of frustum planefarPlanefurthest distance of frustum plane
void YaVirtualCameraAPI.ActiveCameraByEntity(YaEntity vCameraEntity, number blendTime)
Blends the current virtual camera to the target virtual camera from entity that the Camera component is attached to
vCameraEntityThe unique identifier of the entity that contains the Camera component. Entity ID can be found in Advanced Mode.blendTimeThe time in seconds to blend to the new camera
void YaVirtualCameraAPI.ActiveCameraByName(string vCameraName, number blendTime)
Blends the current virtual camera to the target virtual camera created via the Camera component by name
vCameraNameThe name of the camera created via the Camera componentblendTimeThe time in seconds that the current camera blends to the new camera
void YaVirtualCameraAPI.ResetCameraByName(string vCameraName)
Resets the virtual camera's data by virtual camera name
vCameraNameThe name of the virtual camera
void YaVirtualCameraAPI.ResetCameraByEntity(YaEntity vCameraEntity)
Resets the virtual camera's data using the entity that the Camera component is attached to
vCameraEntityThe name of the entity that the Camera component is attached to
void YaVirtualCameraAPI.SetCameraPhysicsEnable(boolean enable)
Enables or disables current virtual camera collisions. In the Fixed camera mode, the collider will not affect camera movement
enableIf true, camera collisions are enabled. If false, camera collisions disabled.