Class WebXRControllerPhysics
Hierarchy (View Summary)
- WebXRAbstractFeature
- WebXRControllerPhysics
Constructors
constructor
-
new WebXRControllerPhysics(
_xrSessionManager: WebXRSessionManager,
_options: IWebXRControllerPhysicsOptions,
): WebXRControllerPhysicsConstruct a new Controller Physics Feature
Parameters
- _xrSessionManager: WebXRSessionManager
the corresponding xr session manager
- _options: IWebXRControllerPhysicsOptions
options to create this feature with
Returns WebXRControllerPhysics
- _xrSessionManager: WebXRSessionManager
Properties
Optionaldepends On
The dependencies of this feature, if any
disable Auto Attach
Should auto-attach be disabled?
is Disposed
Is this feature disposed?
on Feature Attach Observable
Observers registered here will be executed when the feature is attached
on Feature Detach Observable
Observers registered here will be executed when the feature is detached
Static ReadonlyName
The module's name
Static ReadonlyVersion
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
-
get attached(): boolean
Is this feature attached
Returns boolean
xr Native Feature Name
-
get xrNativeFeatureName(): string
The name of the native xr feature name (like anchor, hit-test, or hand-tracking)
Returns string
-
set xrNativeFeatureName(name: string): void
The name of the native xr feature name, if applicable (like anchor, hit-test, or hand-tracking)
Parameters
- name: string
Returns void
Methods
add Controller
-
Manually add a controller (if no xrInput was provided or physics engine was not enabled)
Parameters
- xrController: WebXRInputSource
the controller to add
Returns void
- xrController: WebXRInputSource
attach
-
attach this feature Will usually be called by the features manager
Returns boolean
true if successful.
detach
-
detach this feature. Will usually be called by the features manager
Returns boolean
true if successful.
dispose
-
Dispose this feature and all of the resources attached
Returns void
get Headset Impostor
get Headset Physics Aggregate
-
Get the headset physics aggregate (v2 only)
Returns Nullable<PhysicsAggregate>
the physics aggregate or null
get Impostor For Controller
-
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: string | WebXRInputSource
the controller or the controller id of which to get the impostor
Returns Nullable<PhysicsImpostor>
the impostor or null
- controller: string | WebXRInputSource
get Physics Aggregate For Controller
-
getPhysicsAggregateForController(
controller: string | WebXRInputSource,
): Nullable<PhysicsAggregate>Get the physics aggregate for a controller (v2 only)
Parameters
- controller: string | WebXRInputSource
the controller or the controller id
Returns Nullable<PhysicsAggregate>
the aggregate or null
- controller: string | WebXRInputSource
get Physics Body For Controller
-
Get the physics body for a controller (v2 only)
Parameters
- controller: string | WebXRInputSource
the controller or the controller id
Returns Nullable<PhysicsBody>
the physics body or null
- controller: string | WebXRInputSource
is Compatible
-
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 Properties
-
setPhysicsProperties(
newProperties: {
friction?: number;
impostorSize?: number | { depth: number; height: number; width: number };
impostorType?: number;
restitution?: number;
},
): voidUpdate 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
Returns void
- newProperties: {
Add physics impostor to your webxr controllers, including naive calculation of their linear and angular velocity