Cursor
Updated
Custom mouse cursor image and pointer lock for mouselook.
- Type
comp-cursor- Script class
CursorComponent- Per entity
- One
- Version
- 2.0.0
Read about it in Camera controllers: what it does, how to use it from a script, and examples.
Properties
Section titled “Properties”The props the runtime declares for this component, with their defaults and accepted ranges.
| Prop | Default | Range |
|---|---|---|
hotspot |
||
hotspot.0 |
0 ≤ x ≤ 127 |
|
hotspot.1 |
0 ≤ x ≤ 127 |
Live example
Section titled “Live example”Run it in the browser, read its scripts, and download it as an XR Creator project.
Live example
Draw your own mouse cursorA Cursor component on the camera draws the runtime Lobby demo's pointer image in place of the system cursor over the view. Clicking the crate switches between the custom and the system cursor.
Move the mouse over the view to see the custom pointer; click the crate to switch to the system cursor and back. Drag to orbit the camera, scroll to zoom.
From a script
Section titled “From a script”#pragma lifecycle(startup)
function startup() { const component = self.parent.getComponent(CursorComponent); if (component) log(component.props);}