Request by sending an email to developer@vatom.com
Allows users to interact with the core app.
When extending BasePlugin, these functions can be accessed via this.app.*
When extending BaseComponent, these functions can be accessed via this.plugin.app.*
hasInputCapture(id: string) : Promise<boolean>
Returns true
if the object matching the given identifier has its input captured by a plugin, false
otherwise.
Field | Type | Description | Example |
---|---|---|---|
id | string | Identifier of the object to check | '042ed071-649c-4601-9a30-669a59c9e1ee' |
const hasCapture = await this.app.hasInputCapture('042ed071-649c-4601-9a30-669a59c9e1ee')
console.log(hasCapture) // => false
requestInputCapture(id: string, callback: Function) : Promise<void>
Requests full input event capture of the object matching the given identifier, sending all input events to the given callback function.
While capture is active, all pointer and keyboard events will be sent to the
callback function, and will not be processed by the app. When capturing ends, the
callback function will receive one last message with type
equal to 'input-capture-ended'
.
All events sent to the callback function contain the standard PointerEvent and KeyboardEvent fields, as well as the following extra fields:
windowWidth: number
- Width of the app window in pixelswindowHeight: number
- Height of the app window in pixelsobjectID: string
- Identifier of the object that was specified when the request startedpoint: Vector3
- World coordinates of the hit point, in the form { x: number, y: number, z: number }
uv: Vector2
- UV coordinates of the hit point, in the form { x: number, y: number }
Field | Type | Description | Example |
---|---|---|---|
id | string | Identifier of the object to capture input events for | '042ed071-649c-4601-9a30-669a59c9e1ee' |
callback | Function | Callback function to receive input events | function onEvent(event) { console.log(event) } |
function onEvent(event) {
console.log(event)
}
//
await this.app.requestInputCapture('042ed071-649c-4601-9a30-669a59c9e1ee', onEvent)
stopInputCapture() : void
Stops the current input capture, if it exists.
this.app.stopInputCapture()