Skip to main content

Cursor

Spectacles Interaction Kit provides control and targeting feedback through the cursor components. To support scenarios where users interact from a distance greater than arm’s reach (the “farfield” use case), the InteractorCursor projects along the direction of the user's Interactor, helping users understand how to target more distant objects. The InteractorCursor offers automatic feedback when targeting objects.

To enable each Interactor to benefit from cursor feedback, Spectacles Interaction Kit provides the CursorController component. This component automatically instantiates and manages an InteractorCursor for each Interactor in the scene. The CursorController is included in the starter project by default.

Relevant Components

InteractorCursor reads the state of an Interactor (such as position, direction, and target) to reposition the cursor and adjust visual feedback to reflect current state.

CursorController automatically instantiates an InteractorCursor for each Interactor within the scene, streamlining integration.

Code Example

import { SIK } from 'SpectaclesInteractionKit/SIK';

@component
export class ExampleCursorScript extends BaseScriptComponent {
onAwake() {
this.createEvent('OnStartEvent').bind(() => {
this.onStart();
});
}

onStart() {
let cursorController = SIK.CursorController;

// Disable the visual of all cursors in the scene.
let cursors = cursorController.getAllCursors();
for (const cursor of cursors) {
cursor.enabled = false;
}
}
}
Was this page helpful?
Yes
No