Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Camera

Client camera and CameraItem controls.

The client camera uses ReadonlyTransform. Its position and orientation can not be modified. To manipulate the client camera rotation and position programmatically, use CameraItem.

Index

Type Aliases

MovementType: "fly" | "walk" | "fixed_position" | "fixed" | "orbit"

Defines the movement behavior of a CameraItem.

  • fly - Camera can fly
  • walk - Camera can be walk over the ground and items
  • fixed_position - Movement is disabled. Camera can only rotate
  • fixed - Movement and rotation is disabled
  • orbit - Camera rotates around a fixed point

Variables

collisionCapsuleHeight: number

Defines the Camera collision height.

collisionCapsuleRadius: number

Defines the Camera collision radius.

focusedItem: CameraItem

Defines the CameraItem that the client is currently looking through.

If no CameraItem is focused, this returns null.

gravity: number

Defines the Camera falling speed when walk MovementType is used.

jumpVelocity: number

Defines the jump velocity of the Camera when walk MovementType is used.

Camera jumping is not supported in AR and VR ViewMode.

mouseLocked: boolean

Locks the mouse pointer and binds camera-turning to mouse movement.

To exit locked mouse pointer state, press ESC key.

Only available on platforms that support mouse input.

physicsCollision: boolean

Toggles Camera collision with physics-enabled items.

slopeAngle: number

Defines the maximum slope angle which the Camera can climb up and down.

stayAngle: number

Defines the maximum angle at which the Camera can stay on a slope without sliding down.

Readonly Transform of the client Camera.

To move the Camera by script, use the editable Transform of CameraItem.

Functions

  • addToCollisionFilter(item: BaseItem): void
  • Adds a BaseItem to the Camera collision filter, disabling collisions against it.

    Parameters

    Returns void

  • removeFromCollisionFilter(item: BaseItem): void
  • Removes a BaseItem from the Camera collision filter, enabling collision against it.

    Parameters

    Returns void

  • Converts a position from screen space (e.g. of the mouse) to world space.

    Parameters

    • screenPosition: Vector2

      position in the Camera viewport.

    • distance: number

      local y-axis distance to the Camera.

    Returns Vector3

    converted position in the Scene.

  • Converts a position from world space to screen space.

    Parameters

    • worldPosition: Vector3

      position in the Scene.

    Returns Vector2

    converted position in the Camera viewport.