Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebXRControllerPhysics

Add physics impostor to your webxr controllers, including naive calculation of their linear and angular velocity

Hierarchy

Implements

Index

Constructors

constructor

Properties

disableAutoAttachSearch playground for disableAutoAttach

disableAutoAttach: boolean

Should auto-attach be disabled?

isDisposedSearch playground for isDisposed

isDisposed: boolean

Is this feature disposed?

xrNativeFeatureNameSearch playground for xrNativeFeatureName

xrNativeFeatureName: string

The name of the native xr feature name (like anchor, hit-test, or hand-tracking)

Static Readonly NameSearch playground for Name

Name: "xr-physics-controller" = "xr-physics-controller"

The module's name

Static Readonly VersionSearch playground for Version

Version: 1 = 1

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

Methods

addControllerSearch playground for addController

  • Manually add a controller (if no xrInput was provided or physics engine was not enabled)

    Parameters

    Returns void

attachSearch playground for attach

  • attach(): boolean
  • attach this feature Will usually be called by the features manager

    Returns boolean

    true if successful.

detachSearch playground for detach

  • detach(): boolean
  • detach this feature. Will usually be called by the features manager

    Returns boolean

    true if successful.

disposeSearch playground for dispose

  • dispose(): void

getHeadsetImpostorSearch playground for getHeadsetImpostor

  • Get the headset impostor, if enabled

    Returns PhysicsImpostor | undefined

    the impostor

getImpostorForControllerSearch 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

isCompatibleSearch playground for isCompatible

  • isCompatible(): boolean
  • 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

setPhysicsPropertiesSearch playground for setPhysicsProperties

  • setPhysicsProperties(newProperties: { friction?: number; impostorSize?: number | { depth: number; height: number; width: number }; impostorType?: number; restitution?: number }): void
  • 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 impostorSize?: number | { depth: number; height: number; width: number }
      • Optional impostorType?: number
      • Optional restitution?: number

    Returns void

Legend

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