Class: Script<TEventMap>
Defined in: src/core/Script.ts:204
Extends
ScriptMixinObject3D
<TEventMap
>
Extended by
AI
User
GazeController
MouseController
Simulator
SimulatorUser
AudioListener
AudioPlayer
CoreSound
SoundSynthesizer
SpatialAudio
SpeechRecognizer
SpeechSynthesizer
View
ModelViewer
PagerState
TextScrollerState
UI
DragManager
VideoStream
ObjectDetector
PlaneDetector
World
BackgroundMusic
Type Parameters
TEventMap
TEventMap
extends THREE.Object3DEventMap
= THREE.Object3DEventMap
Constructors
Constructor
new Script<
TEventMap
>():Script
<TEventMap
>
Defined in: node_modules/@types/three/src/core/Object3D.d.ts:95
This creates a new Object3D object.
Returns
Script
<TEventMap
>
Inherited from
ScriptMixinObject3D<TEventMap>.constructor
Properties
isXRScript
isXRScript:
boolean
=true
Defined in: src/core/Script.ts:53
Inherited from
ux
ux:
UX
Defined in: src/core/Script.ts:52
Inherited from
Methods
dispose()
dispose():
void
Defined in: src/core/Script.ts:196
Called when the script is removed from the scene. Opposite of init.
Returns
void
Inherited from
ScriptMixinObject3D.dispose
init()
init(
_?
):void
|Promise
<void
>
Defined in: src/core/Script.ts:62
Initializes an instance with XR controllers, grips, hands, raycaster, and default options. We allow all scripts to quickly access its user (e.g., user.isSelecting(), user.hands), world (e.g., physical depth mesh, lighting estimation, and recognized objects), and scene (the root of three.js's scene graph). If this returns a promise, we will wait for it.
Parameters
_?
object
Returns
void
| Promise
<void
>
Inherited from
ScriptMixinObject3D.init
initPhysics()
initPhysics(
_physics
):void
|Promise
<void
>
Defined in: src/core/Script.ts:72
Enables depth-aware interactions with physics. See /demos/ballpit
Parameters
_physics
Returns
void
| Promise
<void
>
Inherited from
ScriptMixinObject3D.initPhysics
onHoverEnter()
onHoverEnter(
_controller
):void
Defined in: src/core/Script.ts:157
Called when the controller starts hovering over this object with reticle.
Parameters
_controller
An XR controller.
Returns
void
Inherited from
ScriptMixinObject3D.onHoverEnter
onHoverExit()
onHoverExit(
_controller
):void
Defined in: src/core/Script.ts:162
Called when the controller hovers over this object with reticle.
Parameters
_controller
An XR controller.
Returns
void
Inherited from
ScriptMixinObject3D.onHoverExit
onHovering()
onHovering(
_controller
):void
Defined in: src/core/Script.ts:167
Called when the controller hovers over this object with reticle.
Parameters
_controller
An XR controller.
Returns
void
Inherited from
ScriptMixinObject3D.onHovering
onKeyDown()
onKeyDown(
_event
):void
Defined in: src/core/Script.ts:109
Called on keyboard keypress.
Parameters
_event
Event containing .code
to read the keyboard key.
Returns
void
Inherited from
ScriptMixinObject3D.onKeyDown
onKeyUp()
onKeyUp(
_event
):void
Defined in: src/core/Script.ts:110
Parameters
_event
Returns
void
Inherited from
ScriptMixinObject3D.onKeyUp
onObjectGrabbing()
onObjectGrabbing(
_event
):void
Defined in: src/core/Script.ts:187
Called every frame a hand is grabbing this object.
Parameters
_event
Returns
void
Inherited from
ScriptMixinObject3D.onObjectGrabbing
onObjectGrabEnd()
onObjectGrabEnd(
_event
):void
Defined in: src/core/Script.ts:191
Called when a hand stops grabbing this object.
Parameters
_event
Returns
void
Inherited from
ScriptMixinObject3D.onObjectGrabEnd
onObjectGrabStart()
onObjectGrabStart(
_event
):void
Defined in: src/core/Script.ts:183
Called when a hand starts grabbing this object (touching + pinching).
Parameters
_event
Returns
void
Inherited from
ScriptMixinObject3D.onObjectGrabStart
onObjectSelectEnd()
onObjectSelectEnd(
_event
):boolean
Defined in: src/core/Script.ts:150
Called when the controller stops selecting this object the script represents, e.g. View, ModelView.
Parameters
_event
event.target holds its controller.
Returns
boolean
Whether the event was handled
Inherited from
ScriptMixinObject3D.onObjectSelectEnd
onObjectSelectStart()
onObjectSelectStart(
_event
):boolean
Defined in: src/core/Script.ts:141
Called when the controller starts selecting this object the script represents, e.g. View, ModelView.
Parameters
_event
event.target holds its controller.
Returns
boolean
Whether the event was handled
Inherited from
ScriptMixinObject3D.onObjectSelectStart
onObjectTouchEnd()
onObjectTouchEnd(
_event
):void
Defined in: src/core/Script.ts:179
Called when a hand's index finger stops touching this object.
Parameters
_event
Returns
void
Inherited from
ScriptMixinObject3D.onObjectTouchEnd
onObjectTouching()
onObjectTouching(
_event
):void
Defined in: src/core/Script.ts:175
Called every frame that a hand's index finger is touching this object.
Parameters
_event
Returns
void
Inherited from
ScriptMixinObject3D.onObjectTouching
onObjectTouchStart()
onObjectTouchStart(
_event
):void
Defined in: src/core/Script.ts:171
Called when a hand's index finger starts touching this object.
Parameters
_event
Returns
void
Inherited from
ScriptMixinObject3D.onObjectTouchStart
onSelect()
onSelect(
_event
):void
Defined in: src/core/Script.ts:98
Called whenever pinch / mouse click successfully completes, globally.
Parameters
_event
event.target holds its controller.
Returns
void
Inherited from
ScriptMixinObject3D.onSelect
onSelectEnd()
onSelectEnd(
_event
):void
Defined in: src/core/Script.ts:92
Called whenever pinch / mouse click discontinues, globally.
Parameters
_event
event.target holds its controller
Returns
void
Inherited from
ScriptMixinObject3D.onSelectEnd
onSelecting()
onSelecting(
_event
):void
Defined in: src/core/Script.ts:103
Called whenever pinch / mouse click is happening, globally.
Parameters
_event
Returns
void
Inherited from
ScriptMixinObject3D.onSelecting
onSelectStart()
onSelectStart(
_event
):void
Defined in: src/core/Script.ts:86
Called whenever pinch / mouse click starts, globally.
Parameters
_event
event.target holds its controller
Returns
void
Inherited from
ScriptMixinObject3D.onSelectStart
onSimulatorStarted()
onSimulatorStarted():
void
Defined in: src/core/Script.ts:78
Returns
void
Inherited from
ScriptMixinObject3D.onSimulatorStarted
onSqueeze()
onSqueeze(
_event
):void
Defined in: src/core/Script.ts:132
Called whenever gamepad trigger successfully completes, globally.
Parameters
_event
event.target holds its controller.
Returns
void
Inherited from
ScriptMixinObject3D.onSqueeze
onSqueezeEnd()
onSqueezeEnd(
_event
):void
Defined in: src/core/Script.ts:121
Called whenever gamepad trigger stops, globally.
Parameters
_event
event.target holds its controller.
Returns
void
Inherited from
ScriptMixinObject3D.onSqueezeEnd
onSqueezeStart()
onSqueezeStart(
_event
):void
Defined in: src/core/Script.ts:116
Called whenever gamepad trigger starts, globally.
Parameters
_event
event.target holds its controller.
Returns
void
Inherited from
ScriptMixinObject3D.onSqueezeStart
onSqueezing()
onSqueezing(
_event
):void
Defined in: src/core/Script.ts:126
Called whenever gamepad is being triggered, globally.
Parameters
_event
Returns
void
Inherited from
ScriptMixinObject3D.onSqueezing
onXRSessionEnded()
onXRSessionEnded():
void
Defined in: src/core/Script.ts:76
Returns
void
Inherited from
ScriptMixinObject3D.onXRSessionEnded
onXRSessionStarted()
onXRSessionStarted(
_session?
):void
Defined in: src/core/Script.ts:75
Parameters
_session?
Returns
void
Inherited from
ScriptMixinObject3D.onXRSessionStarted
physicsStep()
physicsStep():
void
Defined in: src/core/Script.ts:73
Returns
void
Inherited from
ScriptMixinObject3D.physicsStep
update()
update(
_time?
,_frame?
):void
Defined in: src/core/Script.ts:67
Runs per frame.
Parameters
_time?
number
_frame?
Returns
void
Inherited from
ScriptMixinObject3D.update