Search⌘ K
AI Features

Moving Objects with Mouse

Explore how to interactively move 3D objects in Three.js scenes by using DragControls. Learn to enable drag start and end events to change object properties and manage camera controls. Discover the basics of TransformControls for modifying object shapes with an integrated UI, enhancing your 3D animations and interactions.

Dragging objects

Besides selecting an object, a common requirement is the ability to drag and move objects. Three.js also provides default support for this. The following screenshot shows the output:

Dragging an object around the scene using the mouse
Dragging an object around the scene using the mouse

Example: Dragging objects

Let’s execute the dragging-objects.js example in the below playground and see it in the output. This ...