Skip to content

Commit

Permalink
add XR and input event methods
Browse files Browse the repository at this point in the history
  • Loading branch information
marwie committed Jan 25, 2024
1 parent 5865801 commit ce6e657
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions documentation/scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,29 @@ Note that lifecycle methods are only being called when they are declared. So onl
| `onTriggerStay(col : Collision)` |
| `onTriggerExit(col : Collision)` |

### Input event methods
| Method name | Description |
| -- | --
| `onPointerEnter(args : PointerEventData)` | Called when a cursor starts to hover over an object (or any of it's children)
| `onPointerMove(args : PointerEventData)` | Called when a cursor moves over an object (or any of it's children)
| `onPointerExit(args : PointerEventData)` | Called when a cursor exists (stops hovering) an object
| `onPointerDown(args : PointerEventData)` | Called when a cursor is pressed over an object
| `onPointerUp(args : PointerEventData)` | Called when a cursor is released over an object
| `onPointerClick(args : PointerEventData)` | Called when a cursor is clicked over an object


### XR event methods
*requires Needle Engine >= 3.32.0*
| Method name | Description |
| -- | --
| `supportsXR(mode: XRSessionMode)` | Optionally implement if you only want to receive XR callbacks for specific XR modes like `immersive-vr` or `immersive-ar`. Return `true` to notify the system that you want callbacks for the passed in mode
| `onBeforeXR(mode: XRSessionMode, init: XRSessionInit)` | Called right before a XRSession is requested and can be used to modify the XRSessionInit object
| `onEnterXR(args: NeedleXREventArgs)` | Callback when this component joins a xr session (or becomes active in a running XR session)
| `onUpdateXR(args: NeedleXREventArgs)` | Callback when a xr session updates (while it is still active in XR session)
| `onLeaveXR(args: NeedleXREventArgs)` |
| `onControllerAdded(args: NeedleXRControllerEventArgs)` | Callback when a controller is connected/added while in a XR session OR when the component joins a running XR session that has already connected controllers OR when the component becomes active during a running XR session that has already connected controllers
| `onControllerRemoved(args: NeedleXRControllerEventArgs)` | callback when a controller is removed while in a XR session OR when the component becomes inactive during a running XR session

### Coroutines

Coroutines can be declared using the [JavaScript Generator Syntax](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator).
Expand Down

0 comments on commit ce6e657

Please sign in to comment.