Class WebXRCamera
Hierarchy
-
FreeCamera
- WebXRCamera
Index
Constructors
Properties
- apply
Gravity - camera
Direction - camera
Rotation - check
Collisions - compensate
OnFirst Frame - ellipsoid
- ellipsoid
Offset - ignore
Parent Scaling - inputs
- inverse
Rotation Speed - invert
Rotation - locked
Target - no
Rotation Constraint - on
After Camera Teleport - on
Before Camera Teleport - on
Collide - on
Tracking State Changed - rotation
- rotation
Quaternion - speed
- update
UpVector From Rotation
Accessors
Methods
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
apply GravitySearch playground for applyGravity
Enable or disable gravity on the camera.
camera DirectionSearch playground for cameraDirection
Define the current direction the camera is moving to
camera RotationSearch playground for cameraRotation
Define the current rotation the camera is rotating to
check CollisionsSearch playground for checkCollisions
Enable or disable collisions of the camera with the rest of the scene objects.
compensate OnFirst FrameSearch playground for compensateOnFirstFrame
Should position compensation execute on first frame. This is used when copying the position from a native (non XR) camera
ellipsoidSearch playground for ellipsoid
Define the collision ellipsoid of the camera. This is helpful to simulate a camera body like the player body around the camera
ellipsoid OffsetSearch playground for ellipsoidOffset
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.
ignore Parent ScalingSearch playground for ignoreParentScaling
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.
inverse Rotation SpeedSearch playground for inverseRotationSpeed
Speed multiplier for inverse camera panning
invert RotationSearch playground for invertRotation
Reverses mouselook direction to 'natural' panning as opposed to traditional direct panning
locked TargetSearch playground for lockedTarget
Define the current target of the camera as an object or a position.
no Rotation ConstraintSearch playground for noRotationConstraint
Add constraint to the camera to prevent it to move freely in all directions and around all axis.
on After Camera TeleportSearch playground for onAfterCameraTeleport
Observable raised after camera teleportation
on Before Camera TeleportSearch playground for onBeforeCameraTeleport
Observable raised before camera teleportation
on CollideSearch playground for onCollide
Event raised when the camera collide with a mesh in the scene.
Type declaration
-
-
Parameters
-
collidedMesh: AbstractMesh
Returns void
-
-
on Tracking State ChangedSearch playground for onTrackingStateChanged
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
Define the current rotation of the camera
rotation QuaternionSearch playground for rotationQuaternion
Define the current rotation of the camera as a quaternion to prevent Gimbal lock
speedSearch playground for speed
Define the current speed of the camera
update UpVector From RotationSearch playground for updateUpVectorFromRotation
When set, the up vector of the camera will be updated by the rotation of the camera
Accessors
angular Sensibility
-
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
-
collision Mask
-
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
-
keys Down
-
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
-
keys Downward
-
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
-
keys Left
-
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
-
keys Right
-
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
-
keys Up
-
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
-
keys Upward
-
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
-
real World Height
-
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
tracking State
-
Get the current XR tracking state of the camera
Returns WebXRTrackingState
Methods
attach ControlSearch playground for attachControl
-
Attach the input controls to a specific dom element to get the input from.
Parameters
-
Optional noPreventDefault: boolean
Defines whether event caught by the controls should call preventdefault() (https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault)
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
-
detach ControlSearch playground for detachControl
-
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
-
Destroy the camera and release the current resources hold by it.
Returns void
get Class NameSearch playground for getClassName
-
Gets the current instance class name ("WebXRCamera").
Returns string
the class name
get Front PositionSearch playground for getFrontPosition
-
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
-
get TargetSearch playground for getTarget
-
Return the current target position of the camera. This value is expressed in local space.
Returns Vector3
the target position
set TargetSearch playground for setTarget
-
Defines the target the camera should look at.
Parameters
-
target: Vector3
Defines the new target as a Vector or a mesh
Returns void
-
set Transformation From NonVRCameraSearch playground for setTransformationFromNonVRCamera
-
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
-
store StateSearch playground for storeState
-
Store current camera state of the camera (fov, position, rotation, etc..)
Returns Camera
the camera
WebXR Camera which holds the views for the xrSession
https://doc.babylonjs.com/how_to/webxr_camera