Interface CameraHandlePlayer Beta

The handle to control the player's camera movement. You can access the handle with PlayerScript.cameraHandle.

Hierarchy

  • CameraHandle

Methods

  • Beta

    Obtains the current position of the camera in global coordinates. In VR environment, the result indicates the player's eye position. In non-VR environment, the result indicates the camera position based on the current perspective.

    Especially in non-VR environment, the result may be null when the camera is in a specific mode. For instance, when the player starts editing accessories, the result will be null.

    Returns null | Vector3

  • Beta

    Obtains the current rotation of the camera in global coordinates. In VR environment, the result indicates the player's eye position. In non-VR environment, the result indicates the camera rotation based on the current perspective.

    Especially in non-VR environment, the result may be null when the camera is in a specific mode. For instance, when the player starts editing accessories, the result will be null.

    Returns null | Quaternion

  • Beta

    Gets whether the player is using first person view.

    This methods always returns true for the player in VR. When the player is not in VR environment, returns true if the player is using first person view and returns false otherwise.

    This methods will returns a valid value even if camera is in specific modes. You can validate the current camera by calling CameraHandle.getPosition or CameraHandle.getRotation and check the result is not null.

    Returns

    Whether the player is using first person view.

    Returns boolean

  • Beta

    Sets the default value of the field of view for players who are not in VR environment. The field of view is specified as the vertical angle from the bottom to the top of the screen.

    This method has no effect in VR. After changing the field of view by this method, the player can still zoom in and out, and switch between first and third person perspectives using zoom.

    The value specified in this method will be reset when calling the method with value is null, or when the validity period of the Player Script expires.

    Parameters

    • value: null | number

      The default value of the field of view in degrees, between 10 and 80. The outsided value will be clamped.

    • immediate: boolean

      If true, the value is applied immediately without interpolation. This parameter is optional, and if omitted, it is treated as false.

    Returns void

  • Beta

    In third-person view, sets whether to fix the avatar's orientation so that it faces forward. This method can be used for the case that the avatar should aim to objects in the world in third-person view.

    This function can also be executed when the player is in a VR environment or first-person view, but it does not affect behavior in a VR environment or first-person view.

    The value specified in this method will be reset when calling the method with value is null, or when the validity period of the Player Script expires.

    Parameters

    • value: null | boolean

      Whether to fix the avatar's orientation to face forward

    Returns void

  • Beta

    In third-person view, specifies the position on the screen near the avatar's head in screen coordinates. The left edge of the screen corresponds to x=0, and the right edge corresponds to x=1. The bottom edge of the screen corresponds to y=0, and the top edge corresponds to y=1.

    This function can be executed when the player is in a VR environment or in first-person view, but it does not affect behavior in a VR environment or in first-person view.

    The value specified in this method will be reset when calling the method with pos is null, or when the validity period of the Player Script expires.

    Parameters

    • pos: null | Vector2

      The position on the screen near the avatar's head. Both x and y components are rounded to the range 0 to 1.

    • immediate: boolean

      If true, the interpolation is skipped and the value is applied immediately. This value is optional and is treated as false if omitted.

    Returns void

  • Beta

    Specifies the maximum distance between the avatar and the camera in third-person view in meters.

    The actual distance between the camera and the avatar may not be equal to the specified value. If there are walls or ceilings around the avatar, the camera will be closer than the specified distance.

    This function can be executed even when the player is in a VR environment or in first-person view, but it does not affect the behavior in a VR environment or in first-person view.

    The value specified in this method will be reset when calling the method with distance is null, or when the validity period of the Player Script expires.

    Parameters

    • distance: null | number

      The maximum distance between the avatar and the camera. The minimum value is 0.2, and smaller value will be treated same as 0.2.

    • immediate: boolean

      If true, the interpolation is skipped and the value is applied immediately. This value is optional and is treated as false if omitted.

    Returns void

Generated using TypeDoc