Interface CameraHandlePlayer Beta

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

Hierarchy

  • CameraHandle

Methods

  • Beta

    Calculates the camera position as if camera posture is not operated with setPosition() and setRotation(). It calculates the camera position when the camera's global rotation is rotation.

    In VR environment, it ignores rotation and isFirstPersonView values, returning the same value as getPosition(). In non-VR environment, it calculates the camera position based on the view state specified in the argument.

    In non-VR environment, the result of this method may be null when the view has switched to a special mode. For instance, when the player starts editing accessories, it will return null.

    Parameters

    • rotation: Quaternion

      The global rotation of the camera, ignoring the roll angle.

    • isFirstPersonView: boolean

      true for first person view, false for third person view.

    Returns null | Vector3

  • 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

    Specifies the camera position in global coordinates.

    The behavior when this method is called is as follows

    • In VR environment
      • It does not affect the camera position in VR environment
    • In non-VR environment, first person view
      • Switches to the third person view camera
      • The specified camera position is reflected
      • Disables the switching operation between first person and third person views
    • In non-VR environment, third person view
      • The specified camera position is reflected
      • Disables the switching operation between first person and third person views
    • In other special modes (such as when editing accessories)
      • The camera position can be specified, but it is not reflected immediately and is reflected after the special mode ends

    The values specified by this method will reset when called with null for position or when the Player Script ends. After reset, the switching operation between first person and third person views will be enabled again. Additionally, if the view was in first person before calling this method, it will return to first person after the reset.

    Parameters

    • position: null | Vector3

      The global coordinates of the camera.

    Returns void

  • Beta

    Specifies the camera rotation in global coordinates.

    The behavior when this method is called is as follows

    • In VR environment
      • It does not affect the camera rotation in VR environment
    • In non-VR environment, first person view
      • The specified camera rotation is reflected
      • Disables camera rotation through mouse dragging
      • Does not affect the camera rotation
    • In non-VR environment, third person view
      • The specified camera rotation is reflected
      • Disables camera rotation through mouse dragging
      • The camera position is changed according to the camera rotation and the player's position
    • In other special modes (such as when editing accessories)
      • The camera rotation can be specified, but it is not reflected immediately and is reflected after the special mode ends

    When this method is called with null for rotation or when the Player Script ends, the player will be able to manipulate the camera rotation again. At this point, the camera rotation will be reset to what it was last specified in setRotation(), excluding the roll angle.

    Parameters

    • rotation: null | Quaternion

      The global rotation of the camera.

    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