InputComponent
InputComponent
Native input component.
Provides access to a native input component instance.
- InputComponent
- .InputComponent.Properties: Record<string, ComponentProperty>
- .InputComponent.TypeName: string
- .InputComponent.onRegister: (engine: WonderlandEngine) ⇒ void
- .active
- .active
- .engine
- .handedness
- .inputType
- .inputType
- .object
- .type
- .xrInputSource
- .destroy() ⇒ void
- .equals(otherComponent) ⇒ boolean
- .init() ⇒ void
- .onActivate() ⇒ void
- .onDeactivate() ⇒ void
- .onDestroy() ⇒ void
- .start() ⇒ void
- .update(delta) ⇒ void
.Properties: Record<string, ComponentProperty>
Properties of this component class.
Properties are public attributes that can be configured via the Wonderland Editor.
Example:
|
|
Properties are automatically added to each component instance, and are accessible like any JS attribute:
|
|
.TypeName: string
.onRegister: (engine: WonderlandEngine) ⇒ void
Called when this component class is registered.
Example: This callback can be used to register dependencies of a component, e.g., component classes that need to be registered in order to add them at runtime with addComponent, independent of whether they are used in the editor.
Example: This callback can be used to register different implementations of a component depending on client features or API versions.
|
|
.active
Whether this component is active
.active
Whether this component is active
.engine
Hosting engine instance.
.handedness
’left’, ‘right’ or null
depending on the inputType.
.inputType
Input component type
.inputType
Input component type
.object
The object this component is attached to.
.type
The name of this component’s type
.xrInputSource
WebXR Device API input source associated with this input component, if type ControllerLeft or ControllerRight.
.destroy() ⇒ void
0.9.0+Remove this component from its objects and destroy it.
It is best practice to set the component to null
after,
to ensure it does not get used later.
.equals(otherComponent: undefined | null | Component) ⇒ boolean
Checks equality by comparing whether the wrapped native component ids and component manager types are equal.
Returns: Whether this component equals the given component.
Param | Type | Description |
---|---|---|
otherComponent | undefined | null | Component | Component to check equality with. |
.init() ⇒ void
Triggered when the component is initialized by the runtime. This method will only be triggered once after instantiation.
.onActivate() ⇒ void
Triggered when the component goes from an inactive state to an active state.
Note: You can manually activate or deactivate a component using: active.
.onDeactivate() ⇒ void
Triggered when the component goes from an activated state to an inactive state.
Note: You can manually activate or deactivate a component using: active.
.onDestroy() ⇒ void
0.9.0+Triggered when the component is removed from its object.
Note: You can remove a component using: destroy.
.start() ⇒ void
Triggered when the component is started by the runtime, or activated.
You can use that to re-initialize the state of the component.
.update(delta: number) ⇒ void
Triggered every frame by the runtime.
You should perform your business logic in this method. Example:
|
|
Param | Type | Description |
---|---|---|
delta | number | Elapsed time between this frame and the previous one, in seconds. |