Roblox UtilitiesDevlHub Roblox Documentation

Class

Dragger

Deprecated
Inherits
Instance › Object
Memory category
Instances

A helper object used to create tools that can drag parts.

Deprecated. This class has been deprecated, as it does not work well with FilteringEnabled, and should not be used in new work.

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.

Methods 4#

AxisRotateRotates the currently dragged part(s) by 90 degrees on the given axis.
MouseDownInitializes a dragging action, specifying which parts to use when dragging.
MouseMoveTries to move the currently dragged part to the point where MouseRay hits another part.
MouseUpStops the current dragging action (made by Dragger:MouseDown()).

AxisRotate(axis: Axis = X): ()#

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.

NameTypeDefaultDescription
axisAxisXThe Axis (X, Y, or Z) around which to rotate.
Returns
  • ()

MouseDown(mousePart: Instance, pointOnMousePart: Vector3, parts: Instances): ()#

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.

NameTypeDefaultDescription
mousePartInstanceThe BasePart under the mouse that serves as the drag handle. Must be a member of parts and must be in the Workspace.
pointOnMousePartVector3A Vector3 in the local coordinate space of mousePart indicating where the mouse initially contacted the part.
partsInstancesAn array of BaseParts to move together during the drag. Must include mousePart and contain at least one element.
Returns
  • ()

MouseMove(mouseRay: Ray): ()#

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.

NameTypeDefaultDescription
mouseRayRayA Ray representing the current mouse position in world space (origin at the camera, direction toward the pointer).
Returns
  • ()

MouseUp(): ()#

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.

Returns
  • ()

Inherited members#

Inherited from Instance 58
Inherited from Object 6
Properties (2)

ClassName, className

Events (1)

Changed