Manages interaction for 3D objects independently of the scene graph.
For objects with an HTMLTexture, the manager computes CSS matrix3d transforms each frame so the underlying HTML elements stay aligned with their meshes. Because the elements are children of the canvas, the browser dispatches pointer events to them natively.
const interactions = new InteractionManager();
interactions.connect( renderer, camera );
// Objects live anywhere in the scene graph
scene.add( mesh );
// Register for interaction separately
interactions.add( mesh );
// In the animation loop
interactions.update();
InteractionManager is an addon, and must be imported explicitly, see Installation#Addons.
import { InteractionManager } from 'three/addons/interaction/InteractionManager.js';
The camera used for computing the element transforms.
Default is null.
The canvas element.
Default is null.
The registered interactive objects.
Adds one or more objects to the manager.
objects
The objects to add.
Stores the renderer and camera needed for computing element transforms.
renderer
The renderer.
camera
The camera.
Disconnects this manager, clearing the renderer and camera references.
Removes one or more objects from the manager.
objects
The objects to remove.
Updates the element transforms for all registered objects. Call this once per frame in the animation loop.