Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebXRCamera

WebXR Camera which holds the views for the xrSession

see

https://doc.babylonjs.com/how_to/webxr_camera

Hierarchy

Index

Constructors

constructor

  • Creates a new webXRCamera, this should only be set at the camera after it has been updated by the xrSessionManager

    Parameters

    • name: string

      the name of the camera

    • scene: Scene

      the scene to add the camera to

    • _xrSessionManager: WebXRSessionManager

      a constructed xr session manager

    Returns WebXRCamera

Properties

applyGravitySearch playground for applyGravity

applyGravity: boolean

Enable or disable gravity on the camera.

cameraDirectionSearch playground for cameraDirection

cameraDirection: Vector3

Define the current direction the camera is moving to

cameraRotationSearch playground for cameraRotation

cameraRotation: Vector2

Define the current rotation the camera is rotating to

checkCollisionsSearch playground for checkCollisions

checkCollisions: boolean

Enable or disable collisions of the camera with the rest of the scene objects.

compensateOnFirstFrameSearch playground for compensateOnFirstFrame

compensateOnFirstFrame: boolean

Should position compensation execute on first frame. This is used when copying the position from a native (non XR) camera

ellipsoidSearch playground for ellipsoid

ellipsoid: Vector3

Define the collision ellipsoid of the camera. This is helpful to simulate a camera body like the player body around the camera

see

https://doc.babylonjs.com/babylon101/cameras,_mesh_collisions_and_gravity#arcrotatecamera

ellipsoidOffsetSearch playground for ellipsoidOffset

ellipsoidOffset: Vector3

Define an offset for the position of the ellipsoid around the camera. This can be helpful to determine the center of the body near the gravity center of the body instead of its head.

ignoreParentScalingSearch playground for ignoreParentScaling

ignoreParentScaling: boolean

Gets or sets a boolean indicating that the scaling of the parent hierarchy will not be taken in account by the camera

inputsSearch playground for inputs

Define the input manager associated to the camera.

inverseRotationSpeedSearch playground for inverseRotationSpeed

inverseRotationSpeed: number

Speed multiplier for inverse camera panning

invertRotationSearch playground for invertRotation

invertRotation: boolean

Reverses mouselook direction to 'natural' panning as opposed to traditional direct panning

lockedTargetSearch playground for lockedTarget

lockedTarget: any

Define the current target of the camera as an object or a position.

noRotationConstraintSearch playground for noRotationConstraint

noRotationConstraint: boolean

Add constraint to the camera to prevent it to move freely in all directions and around all axis.

onAfterCameraTeleportSearch playground for onAfterCameraTeleport

onAfterCameraTeleport: Observable<Vector3>

Observable raised after camera teleportation

onBeforeCameraTeleportSearch playground for onBeforeCameraTeleport

onBeforeCameraTeleport: Observable<Vector3>

Observable raised before camera teleportation

onCollideSearch playground for onCollide

onCollide: (collidedMesh: AbstractMesh) => void

Event raised when the camera collide with a mesh in the scene.

Type declaration

onTrackingStateChangedSearch playground for onTrackingStateChanged

onTrackingStateChanged: Observable<WebXRTrackingState>

Notifies when the camera's tracking state has changed. Notice - will also be triggered when tracking has started (at the beginning of the session)

rotationSearch playground for rotation

rotation: Vector3

Define the current rotation of the camera

rotationQuaternionSearch playground for rotationQuaternion

rotationQuaternion: Quaternion

Define the current rotation of the camera as a quaternion to prevent Gimbal lock

speedSearch playground for speed

speed: number

Define the current speed of the camera

updateUpVectorFromRotationSearch playground for updateUpVectorFromRotation

updateUpVectorFromRotation: boolean

When set, the up vector of the camera will be updated by the rotation of the camera

Accessors

angularSensibility

  • get angularSensibility(): number
  • set angularSensibility(value: number): any
  • Gets the input sensibility for a mouse input. (default is 2000.0) Higher values reduce sensitivity.

    Returns number

  • Sets the input sensibility for a mouse input. (default is 2000.0) Higher values reduce sensitivity.

    Parameters

    • value: number

    Returns any

collisionMask

  • get collisionMask(): number
  • set collisionMask(mask: number): any
  • Define a collision mask to limit the list of object the camera can collide with

    Returns number

  • Define a collision mask to limit the list of object the camera can collide with

    Parameters

    • mask: number

    Returns any

keysDown

  • get keysDown(): number[]
  • set keysDown(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the backward move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the backward move of the camera.

    Parameters

    • value: number[]

    Returns any

keysDownward

  • get keysDownward(): number[]
  • set keysDownward(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the downward move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the downward move of the camera.

    Parameters

    • value: number[]

    Returns any

keysLeft

  • get keysLeft(): number[]
  • set keysLeft(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the left strafe move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the left strafe move of the camera.

    Parameters

    • value: number[]

    Returns any

keysRight

  • get keysRight(): number[]
  • set keysRight(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the right strafe move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the right strafe move of the camera.

    Parameters

    • value: number[]

    Returns any

keysUp

  • get keysUp(): number[]
  • set keysUp(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the forward move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the forward move of the camera.

    Parameters

    • value: number[]

    Returns any

keysUpward

  • get keysUpward(): number[]
  • set keysUpward(value: number[]): any
  • Gets or Set the list of keyboard keys used to control the upward move of the camera.

    Returns number[]

  • Gets or Set the list of keyboard keys used to control the upward move of the camera.

    Parameters

    • value: number[]

    Returns any

realWorldHeight

  • get realWorldHeight(): number
  • Return the user's height, unrelated to the current ground. This will be the y position of this camera, when ground level is 0.

    Returns number

target

  • Defines the target point of the camera. The camera looks towards it form the radius distance.

    Returns Vector3

  • Defines the target point of the camera. The camera looks towards it form the radius distance.

    Parameters

    Returns any

trackingState

  • Get the current XR tracking state of the camera

    Returns WebXRTrackingState

Methods

attachControlSearch playground for attachControl

  • attachControl(noPreventDefault?: boolean): void
  • attachControl(ignored: any, noPreventDefault?: boolean): void
  • Attach the input controls to a specific dom element to get the input from.

    Parameters

    Returns void

  • Attach the input controls to a specific dom element to get the input from.

    Parameters

    • ignored: any

      defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl

    • Optional noPreventDefault: boolean

      Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) BACK COMPAT SIGNATURE ONLY.

    Returns void

detachControlSearch playground for detachControl

  • detachControl(): void
  • detachControl(ignored: any): void
  • Detach the current controls from the specified dom element.

    Returns void

  • Detach the current controls from the specified dom element.

    Parameters

    • ignored: any

      defines an ignored parameter kept for backward compatibility. If you want to define the source input element, you can set engine.inputElement before calling camera.attachControl

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Returns void

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Gets the current instance class name ("WebXRCamera").

    Returns string

    the class name

getFrontPositionSearch playground for getFrontPosition

  • getFrontPosition(distance: number): Vector3
  • Gets the position in front of the camera at a given distance.

    Parameters

    • distance: number

      The distance from the camera we want the position to be

    Returns Vector3

    the position

getTargetSearch playground for getTarget

  • Return the current target position of the camera. This value is expressed in local space.

    Returns Vector3

    the target position

setTargetSearch playground for setTarget

  • Defines the target the camera should look at.

    Parameters

    • target: Vector3

      Defines the new target as a Vector

    Returns void

setTransformationFromNonVRCameraSearch playground for setTransformationFromNonVRCamera

  • setTransformationFromNonVRCamera(otherCamera?: Camera, resetToBaseReferenceSpace?: boolean): void
  • Sets this camera's transformation based on a non-vr camera

    Parameters

    • Optional otherCamera: Camera

      the non-vr camera to copy the transformation from

    • Optional resetToBaseReferenceSpace: boolean

      should XR reset to the base reference space

    Returns void

storeStateSearch playground for storeState

  • Store current camera state of the camera (fov, position, rotation, etc..)

    Returns Camera

    the camera

Legend

  • Constructor
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static property
  • Static method