Skip to content

scene.interaction

Pointer hits, clicks, hover state, and dragging.

6 functions / 8 types

Index

FunctionDescription
clicksReport the clicks on the viewport since the last time this action was called.
getInteractableGet whether a scene object is currently interactable.
hoversReport the hovers on the viewport since the last time this action was called.
isDraggingCheck if a scene object is being actively dragged
setDraggableSet a scene object as draggable and poll for recent changes This will also make it interactible.
setInteractableSet whether a scene object is interactable.
TypeDescription
BlockModelHitDataKind-specific data about hitting a block model
ClickOne click on a scene node, as reported by Clicks.
HitOne scene node under the cursor, as reported by Hovers.
HitDataKind-specific data about hitting an object
MeshHitDataKind-specific data about hitting a mesh
PointCloudHitDataKind-specific data about hitting a point cloud
PolylineHitDataKind-specific data about hitting a polyline
ShapeHitDataKind-specific data about hitting a shape

clicks

clicks(transactionId?: string): Promise<Array<SceneInteractionClick>>

Report the clicks on the viewport since the last time this action was called.

Returns Promise<Array<SceneInteractionClick>>.

transactionId optional : string

getInteractable

getInteractable(args: { node: SceneNode }, transactionId?: string): Promise<boolean>

Get whether a scene object is currently interactable.

Returns Promise<boolean>.

node : SceneNode

transactionId optional : string

hovers

hovers(transactionId?: string): Promise<Array<SceneInteractionHit>>

Report the hovers on the viewport since the last time this action was called.

Returns Promise<Array<SceneInteractionHit>>.

transactionId optional : string

isDragging

isDragging(args: { node: SceneNode }, transactionId?: string): Promise<boolean>

Check if a scene object is being actively dragged

Returns Promise<boolean>.

node : SceneNode

The NodeSchema of the shape to make draggable.

transactionId optional : string

setDraggable

setDraggable(args: { dragKind?: SceneDragKind; node: SceneNode }, transactionId?: string): Promise<void>

Set a scene object as draggable and poll for recent changes This will also make it interactible.

Returns Promise<void>.

dragKind optional : SceneDragKind

How the drag moves the shape. Absent leaves it dragging in the plane facing the camera.

node : SceneNode

The NodeSchema of the shape to make draggable.

transactionId optional : string

setInteractable

setInteractable(args: { interactible?: boolean; node: SceneNode }, transactionId?: string): Promise<void>

Set whether a scene object is interactable.

Returns Promise<void>.

interactible optional : boolean

If unset, this will default to true.

node : SceneNode

transactionId optional : string

BlockModelHitData

Kind-specific data about hitting a block model

leaf : SceneLeafDescription

The element to pass to the component’s inspect_leaf query.

Click

One click on a scene node, as reported by Clicks.

hit : SceneInteractionHit

The underlying hit.

mouseButton : number

Which mouse button: 0 primary, 1 secondary, 2 middle.

Hit

One scene node under the cursor, as reported by Hovers.

info : SceneInteractionHitData

Additional data specific to the kind of scene object hit

node : SceneNode

The scene node under the cursor.

position : MathVec3

World position of the point under the cursor.

HitData

type SceneInteractionHitData = { kind: "blockModel"; value: SceneInteractionBlockModelHitData } | { kind: "pointCloud"; value: SceneInteractionPointCloudHitData } | { kind: "mesh"; value: SceneInteractionMeshHitData } | { kind: "polyline"; value: SceneInteractionPolylineHitData } | { kind: "shape"; value: SceneInteractionShapeHitData }

Kind-specific data about hitting an object

MeshHitData

Kind-specific data about hitting a mesh

PointCloudHitData

Kind-specific data about hitting a point cloud

leaf : SceneLeafDescription

The element to pass to the component’s inspect_leaf query.

PolylineHitData

Kind-specific data about hitting a polyline

ShapeHitData

Kind-specific data about hitting a shape