Object3D instances fire various events that can be listened to usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jscastro76/threebox/llms.txt
Use this file to discover all available pages before exploring further.
addEventListener. All events include the object itself in the detail property of the event.
Selection Events
Fired when the object’s selection state changes.Event Detail:
selected(boolean): Whether the object is now selecteddetail(Object3D): The object that was selected/unselected
- Object is clicked when
tb.enableSelectingObjectsistrue - Object is programmatically selected/unselected via
obj.selected = true/false - Another object is selected (implicitly unselects this object)
Mouse Events
Fired when the mouse cursor enters the object’s bounds.Event Detail:
detail(Object3D): The object being hovered
- Mouse cursor moves over the object when raycasting is enabled
- Bounding box becomes visible if configured
- Label becomes visible if configured
Fired when the mouse cursor leaves the object’s bounds.Event Detail:
detail(Object3D): The object that was being hovered
- Mouse cursor moves away from the object
- Bounding box becomes hidden (if not selected)
- Label becomes hidden (if not alwaysVisible and not selected)
Drag Events
Fired when the object is dragged and then released.Event Detail:
detail(Object3D): The object that was draggeddraggedAction(string): Type of drag action -'translate','altitude', or'rotate'
- Object is selected and
tb.enableDraggingObjectsistrue - User holds SHIFT and drags to translate horizontally (
draggedAction = 'translate') - User holds CTRL and drags to change altitude (
draggedAction = 'altitude') - Object is selected and
tb.enableRotatingObjectsistrue - User holds ALT and drags to rotate (
draggedAction = 'rotate')
Visual State Events
Fired when the object’s wireframe mode is toggled.Event Detail:
detail(Object3D): The object whose wireframe state changed
obj.wireframeproperty is changed totrueorfalse
Fired when the object undergoes significant changes that require scene updates.Event Detail:
detail(Object3D): The object that changed
- Object properties are modified
- Object is transformed (position, rotation, scale)
- Object state changes requiring re-render
Animation Events
Fired when the object’s animation playback state changes.Event Detail:
detail(Object3D): The object whose animation state changedisPlaying(boolean): Whether animation is now playing
- Animation is started or stopped on an object that contains animations
- Only applicable to objects loaded with animations (GLTF/GLB models)