Classes
Members
buttons
left and right buttons.
- Source:
controllerObserver
Function that tracks turning XR controllers on/off
- Source:
movementMode
or NONE, or SLIDE
- Source:
squeeze
left and right squeeze, if available
- Source:
stateChangeObserver
Function that tracks enter/exit VR
- Source:
thumbstick
left and right thumbstick, if available
- Source:
touchpad
left and right touchpad, if available
- Source:
trigger
left and right trigger, if available
- Source:
vrHelper
Underlying babylon VR (obsolete) or XR helper (WebXRDefaultExperience) component
- Source:
world :World
Type:
- Source:
Methods
addFloorMesh()
Internally used to add teleportation mesh
- Source:
addFloors()
Adds all world floor meshes to teleportation
- Source:
addSqueezeConsumer(callback)
Adds given callback to the list of XR controller squeeze button consumer.
Consumer is passed value(0-1) and side (left/right) of the event.
If it consumes the event, returns false.
Parameters:
Name | Type | Description |
---|---|---|
callback |
returns true if processing should continue |
- Source:
addTriggerListener()
Adds given callback to the list of XR controller trigger listeners
CHECKME: include gamepad trigger?
- Source:
afterTeleportation()
Called after teleoportation to update non-VR world camera and dynamic terrain if needed
- Source:
armPos(side)
Returns the absolute position of left or right controller grip
Parameters:
Name | Type | Description |
---|---|---|
side |
left or right |
- Source:
armRot(side)
Returns the rotation quaternion of left or right controller grip
Parameters:
Name | Type | Description |
---|---|---|
side |
left or right |
- Source:
camera()
Returns the current WebXRCamera
- Source:
changePosition()
Change position of WebXRCamera by given distance, i.e. moves forward or back
- Source:
changeRotation()
Rotates the WebXRCamera by given angle
- Source:
clearFloors()
Removes all current teleportation meshes
- Source:
clearPointer()
Removes pointer ray and target
- Source:
createPointer()
Creates pointer ray and intersection mesh.
- Source:
disableMovement()
Disable both teleportation and sliding.
- Source:
enableMovement(mode)
Enable movement in given mode
Parameters:
Name | Type | Description |
---|---|---|
mode |
string | TELEPORT or SLIDE |
- Source:
enableSliding()
Experimental, quite limited.
Disable teleportation and enable sliding movement.
Movement then ignores collisions, i.e. camera flies through everything.
Correctly implementing this will require collision calculation using a collider mesh,
mesh.moveWithCollisions(), then setting camera positon - much like AvatarMovement.moveAvatar().
- Source:
enableTeleportation()
Disable sliding movement and enable teleportation.
- Source:
(async) initXR(world)
Parameters:
Name | Type | Description |
---|---|---|
world |
World | attaches the control to the World |
- Source:
leftArmPos()
Returns the absolute position of left controller grip
- Source:
leftArmRot()
Returns the rotation quaternion of left controller grip
- Source:
raySelectionPredicate()
Returns the current ray selection predicate, and optionally installs a new one
- Source:
realWorldHeight()
Returns the height of the user, as defined by WebXRCamera
- Source:
removeFloorMesh()
Internally used to remove teleportation mesh
- Source:
removeSqueezeConsumer()
Remove squeeze listener
- Source:
removeTriggerListener()
Remove trigger listener
- Source:
rightArmPos()
Returns the absolute position of right controller grip
- Source:
rightArmRot()
Returns the rotation quaternion of right controller grip
- Source:
squeezeTracker()
Used internally to track squeeze buttons of VR controllers. Disables the teleporation if a button is pressed.
Calls squeeze listeners, passing the them the value (0-1) and side (left/right);
- Source:
startTracking()
Start XR device tracking: prepare pointer ray and mesh, and register tracking function (trackXrDevices) to scene render loop.
- Source:
stopTracking()
Stop XR device tracking: clean up
- Source:
teleportEnd()
End of teleportation: moves the camera to the destination (this.teleportTarget) and cleans up.
- Source:
teleportStart()
Start of teleportation, when gampad stick is pressed forward.
Installs a ray caster into rendering loop, that moves teleportation destination marker around.
- Source:
trackThumbsticks(callback)
Track thumbsticks on VR controllers. Thumbsticks are used for teleporatation by default,
so this may be useful when teleporation is disabled.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function to call when thumbsticks change, passed position (x,y) and side (left/right) |
- Source:
trackXrDevices()
Called from render loop to set internal state variables, and implements XR pointer for mobile devices.
When XR controllers are unavailable, it renders a ray pointing forward, and moves pointer mesh to
ray intersection with scene meshes.
Calls World.trackXrDevices()
- Source:
triggerTracker()
Used internally to track triggers of VR controllers. Disables the teleporation if a trigger is pressed.
Calls trigger listeners, passing the them the value (0-1) and side (left/right);
- Source:
xrDeviceTracker()
Function that tracks XR devices (headeset, controllers), calls this.trackXrDevices()
- Source: