Dragger
A helper object used to create tools that can drag parts.
| Memory category | Instances |
|---|
Member index 4
Description
The Dragger object is a helper object used to create tools that can drag parts. It is expected (but not required) to be used with Mouse events.
Primarily used with the RbxStamper library.
History 16
- 648 Change Parameters of MouseDown from (mousePart: Instance, pointOnMousePart: Vector3, parts: Objects) to (mousePart: Instance, pointOnMousePart: Vector3, parts: Instances)
- 573 Change ReturnType of MouseUp from void to null
- 573 Change ReturnType of MouseMove from void to null
- 573 Change ReturnType of MouseDown from void to null
- 573 Change ReturnType of AxisRotate from void to null
- 462 Change ThreadSafety of MouseUp from to Unsafe
- 462 Change ThreadSafety of MouseMove from to Unsafe
- 462 Change ThreadSafety of MouseDown from to Unsafe
- 462 Change ThreadSafety of AxisRotate from to Unsafe
- 71 Change Parameters of MouseMove from (MouseRay: Ray) to (mouseRay: Ray)
- 71 Change Parameters of MouseDown from (MousePart: Instance, PointOnMousePart: Vector3, Parts: Objects) to (mousePart: Instance, pointOnMousePart: Vector3, parts: Objects)
- 47 Add MouseUp
- 47 Add MouseMove
- 47 Add MouseDown
- 47 Add AxisRotate
- 47 Add Dragger
Members 4
AxisRotate
| Parameters (1) | Default | |
|---|---|---|
| axis | Axis | X |
| Returns (1) | ||
| null | ||
Rotates the currently dragged part(s) by 90 degrees around the specified
world axis. This method can only be called while a drag is actively in
progress (after Dragger:MouseDown() has been called and
Dragger:MouseMove() has initiated movement). The axis parameter
defaults to Axis.X.
For single-part drags the rotation is performed about the snap face axis. For multi-part drags the rotation is applied around the computed center of the part group using a collision-aware routine that prevents overlap with surrounding geometry.
| Thread safety | Unsafe |
|---|
History 3
- 573 Change ReturnType of AxisRotate from void to null
- 462 Change ThreadSafety of AxisRotate from to Unsafe
- 47 Add AxisRotate
MouseDown
| Parameters (3) | ||
|---|---|---|
| mousePart | Instance | |
| pointOnMousePart | Vector3 | |
| parts | Instances | |
| Returns (1) | ||
| null | ||
Initializes a dragging action by registering the parts to drag and the point on the mouse part where the interaction began. This method does not immediately begin moving parts; actual movement starts on a subsequent Dragger:MouseMove() call once the mouse has moved beyond a break-free threshold (half the current grid snap distance).
mousePart must be a BasePart that is both a member of parts
and a descendant of Workspace. Calling this method while a drag is
already active (before Dragger:MouseUp()) throws an error. While a
drag is pending, camera mouse-pan is disabled so that mouse movement
applies to the drag instead of the viewport.
| Thread safety | Unsafe |
|---|
History 5
- 648 Change Parameters of MouseDown from (mousePart: Instance, pointOnMousePart: Vector3, parts: Objects) to (mousePart: Instance, pointOnMousePart: Vector3, parts: Instances)
- 573 Change ReturnType of MouseDown from void to null
- 462 Change ThreadSafety of MouseDown from to Unsafe
- 71 Change Parameters of MouseDown from (MousePart: Instance, PointOnMousePart: Vector3, Parts: Objects) to (mousePart: Instance, pointOnMousePart: Vector3, parts: Objects)
- 47 Add MouseDown
MouseMove
| Parameters (1) | ||
|---|---|---|
| mouseRay | Ray | |
| Returns (1) | ||
| null | ||
Attempts to move the currently dragged parts to the location indicated by
mouseRay. Must be called after Dragger:MouseDown().
On the first call that detects sufficient mouse movement (exceeding half the grid snap distance), the method transitions into active dragging: it un-joins the dragged parts from surrounding geometry, aligns them to the grid, and begins tracking movement. On each subsequent call, the ray is cast against other parts in the Workspace (or against the world ground plane at Y = 0 if nothing is hit), and the dragged parts are moved toward that snap point using a collision-aware algorithm that prevents them from overlapping existing geometry. Single-part drags use surface snapping; multi-part drags use grid-aligned displacement with Y-drop collision avoidance.
| Thread safety | Unsafe |
|---|
MouseUp
| Parameters (0) | ||
|---|---|---|
| No parameters. | ||
| Returns (1) | ||
| null | ||
Stops the current dragging action initiated by
Dragger:MouseDown(). If parts were actively being dragged, this
method re-joins them to adjacent geometry and finalizes their position. If
MouseDown was called but the mouse never moved far enough to begin
actual dragging, the state is simply reset. In both cases camera mouse-pan
is re-enabled.
Calling this method without a prior Dragger:MouseDown() throws an error.
| Thread safety | Unsafe |
|---|