Skip to content

DragDetector

Not yet Class Physics

Instance which facilitates and encourages interaction with 3D objects in an experience.

Not implemented yet

This class exists in the current Roblox API but is not implemented in Nova yet. Scripts that reference it will fail at runtime.

0 Nova members · 41 modern Roblox members not implemented yet

Description

The DragDetector instance facilitates and encourages interaction with 3D objects in an experience, such as opening doors and drawers, sliding a part around, and much more. Key features include:

  • Place a DragDetector under any BasePart or Model to make it draggable via all inputs (mouse, touch, gamepad, and VR), all without a single line of code.

  • Choose from several DragStyle options, define how the object responds to motion via ResponseStyle, and optionally apply axis or movement limits.

  • Scripts can respond to manipulation of dragged objects to drive UI or make logical decisions, such as adjusting the light level in a room based on a sliding wall switch dimmer.

  • Players can manipulate anchored parts or models and they'll stay exactly where you put them upon release.

  • DragDetectors work in Studio as long as you're not using the Select, Move, Scale, or Rotate tools, making it easier to test and adjust draggable objects while editing.

See the 3D Drag Detectors guide for details and usage examples.

Inheritance

Object → Instance → ClickDetector → DragDetector

Properties

Member Signature Summary
ActivatedCursorIcon ActivatedCursorIcon: ContentId Sets the cursor icon to display when the mouse is activated over the parent of this DragDetector.
ActivatedCursorIconContent ActivatedCursorIconContent: Content Sets the cursor icon to display when the mouse is activated over the parent of this DragDetector. Only supports asset URIs
ApplyAtCenterOfMass ApplyAtCenterOfMass: bool Whether constraint force is applied to the object's center of mass.
Axis Axis: Vector3 The primary axis of motion, expressed relative to the reference frame.
DragFrame DragFrame: CFrame The CFrame of the pivot, dependent on the drag detector's ReferenceInstance.
DragStyle DragStyle: DragDetectorDragStyle The paradigm used to generate proposed motion.
Enabled Enabled: bool Whether the DragDetector responds to user input.
GamepadModeSwitchKeyCode GamepadModeSwitchKeyCode: KeyCode During gamepad input, the modifier KeyCode for the secondary mode of motion.
KeyboardModeSwitchKeyCode KeyboardModeSwitchKeyCode: KeyCode During keyboard input, the modifier KeyCode for the secondary mode of motion.
MaxDragAngle MaxDragAngle: float Along with MinDragAngle, impedes the drag detector's attempts to generate motion.
MaxDragTranslation MaxDragTranslation: Vector3 Along with MinDragTranslation, impedes the drag detector's attempts to generate motion.
MaxForce MaxForce: float Maximum force applied for the object to reach its goal.
MaxTorque MaxTorque: float Maximum torque applied for the object to reach its goal.
MinDragAngle MinDragAngle: float Along with MaxDragAngle, impedes the drag detector's attempts to generate motion.
MinDragTranslation MinDragTranslation: Vector3 Along with MaxDragTranslation, impedes the drag detector's attempts to generate motion.
Orientation Orientation: Vector3 Specifies the YXZ rotation of axes of motion relative to the reference frame.
PermissionPolicy PermissionPolicy: DragDetectorPermissionPolicy Controls the permission level for which players can interact with the DragDetector.
PhysicalDragClickedPart PhysicalDragClickedPart: Instance —
PhysicalDragHitPoint PhysicalDragHitPoint: Vector3 —
PhysicalDragIsInVR PhysicalDragIsInVR: bool —
PhysicalDragTargetFrame PhysicalDragTargetFrame: CFrame —
ReferenceInstance ReferenceInstance: Instance An instance whose CFrame is the reference frame for the drag detector.
ResponseStyle ResponseStyle: DragDetectorResponseStyle The paradigm used to move, or not move, the objects affected by the drag detector.
Responsiveness Responsiveness: float Higher values cause the object to reach its goal more rapidly.
RunLocally RunLocally: bool Whether user input on a DragDetector replicates to the server or remains local to the specific client.
SecondaryAxis SecondaryAxis: Vector3 The secondary axis of the motion.
TrackballRadialPullFactor TrackballRadialPullFactor: float If DragStyle is DragDetectorDragStyle.RotateTrackball, multiplier for adding a radial p…
TrackballRollFactor TrackballRollFactor: float If DragStyle is DragDetectorDragStyle.RotateTrackball, multiplier for adding roll rotat…
VRSwitchKeyCode VRSwitchKeyCode: KeyCode During VR input, the modifier KeyCode for the secondary mode of motion.
WorldAxis WorldAxis: Vector3 The Axis expressed in world space.
WorldSecondaryAxis WorldSecondaryAxis: Vector3 The SecondaryAxis expressed in world space.

Methods

Member Signature Summary
AddConstraintFunction DragDetector:AddConstraintFunction(priority: int, function: Function): RBXScriptConnection Adds a function to modify or constrain proposed motion.
GetReferenceFrame DragDetector:GetReferenceFrame(): CFrame Returns the reference CFrame in which motion is expressed.
RestartDrag DragDetector:RestartDrag(): null May be invoked from a script to restart the drag using new parameters.
SetDragStyleFunction DragDetector:SetDragStyleFunction(function: Function): null Passes a function to be used if and only if DragStyle is set to [DragDetectorDragStyle.Scriptable](../enums/DragDetectorDragStyle.md#scripta…
SetPermissionPolicyFunction DragDetector:SetPermissionPolicyFunction(function: Function): null Passes a function to be used if and only if PermissionPolicy is set to [DragDetectorPermissionPolicy.Scriptable](../enums/DragDetecto…

Events

Member Signature Summary
DragContinue DragContinue(playerWhoDragged: Player, cursorRay: Ray, viewFrame: CFrame, vrInputFrame: OptionalCoordinateFrame, isModeSwitchKeyDown: bool) Fires when a user continues dragging the object after DragStart has been initiated.
DragContinueReplicate DragContinueReplicate(playerWhoDragged: Player, cursorRay: Ray, viewFrame: CFrame, vrInputFrame: OptionalCoordinateFrame, isModeSwitchKeyDown: bool) —
DragEnd DragEnd(playerWhoDragged: Player) Fires when a user stops dragging the object.
DragEndReplicate DragEndReplicate(playerWhoDragged: Player) —
DragStart DragStart(playerWhoDragged: Player, cursorRay: Ray, viewFrame: CFrame, hitFrame: CFrame, clickedPart: BasePart, vrInputFrame: OptionalCoordinateFrame, isModeSwitchKeyDown: bool) Fires when a user starts dragging the object.
DragStartReplicate DragStartReplicate(playerWhoDragged: Player, cursorRay: Ray, viewFrame: CFrame, hitFrame: CFrame, clickedPart: BasePart, vrInputFrame: OptionalCoordinateFrame, isModeSwitchKeyDown: bool) —
RestartPhysicalDragReplicate RestartPhysicalDragReplicate(hitPoint: Vector3) —

Roblox reference: DragDetector

Generated from Nova's API dump and Roblox creator-docs. Nova-only members come from the engine's reflection metadata.