Class WebXRControllerPhysics
Hierarchy
-
WebXRAbstractFeature
- WebXRControllerPhysics
Implements
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Construct a new Controller Physics Feature
Parameters
-
_xrSessionManager: WebXRSessionManager
the corresponding xr session manager
-
_options: IWebXRControllerPhysicsOptions
options to create this feature with
Returns WebXRControllerPhysics
-
Properties
disable Auto AttachSearch playground for disableAutoAttach
Should auto-attach be disabled?
is DisposedSearch playground for isDisposed
Is this feature disposed?
xr Native Feature NameSearch playground for xrNativeFeatureName
The name of the native xr feature name (like anchor, hit-test, or hand-tracking)
Static Readonly NameSearch playground for Name
The module's name
Static Readonly VersionSearch playground for Version
The (Babylon) version of this module. This is an integer representing the implementation version. This number does not correspond to the webxr specs version
Accessors
attached
-
Is this feature attached
Returns boolean
Methods
add ControllerSearch playground for addController
-
Manually add a controller (if no xrInput was provided or physics engine was not enabled)
Parameters
-
xrController: WebXRInputSource
the controller to add
Returns void
-
attachSearch playground for attach
-
attach this feature Will usually be called by the features manager
Returns boolean
true if successful.
detachSearch playground for detach
-
detach this feature. Will usually be called by the features manager
Returns boolean
true if successful.
disposeSearch playground for dispose
-
Dispose this feature and all of the resources attached
Returns void
get Headset ImpostorSearch playground for getHeadsetImpostor
-
Get the headset impostor, if enabled
Returns PhysicsImpostor | undefined
the impostor
get Impostor For ControllerSearch playground for getImpostorForController
-
Get the physics impostor of a specific controller. The impostor is not attached to a mesh because a mesh for each controller is not obligatory
Parameters
-
controller: WebXRInputSource | string
the controller or the controller id of which to get the impostor
Returns Nullable<PhysicsImpostor>
the impostor or null
-
is CompatibleSearch playground for isCompatible
-
This function will be executed during before enabling the feature and can be used to not-allow enabling it. Note that at this point the session has NOT started, so this is purely checking if the browser supports it
Returns boolean
whether or not the feature is compatible in this environment
set Physics PropertiesSearch playground for setPhysicsProperties
-
Update the physics properties provided in the constructor
Parameters
-
newProperties: { friction?: number; impostorSize?: number | { depth: number; height: number; width: number }; impostorType?: number; restitution?: number }
the new properties object
-
Optional friction?: number
-
Optional impostor
Size?: number | { depth: number; height: number; width: number } -
Optional impostor
Type?: number -
Optional restitution?: number
-
Returns void
-
Add physics impostor to your webxr controllers, including naive calculation of their linear and angular velocity