DragDetector

Show Deprecated

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.

Summary

Properties

Properties inherited from ClickDetector

Properties

Methods

Events

Events inherited from ClickDetector

Events

Properties

ActivatedCursorIcon

ContentId
Read Parallel

ApplyAtCenterOfMass

Read Parallel
Not Replicated
Read Parallel

DragFrame

Read Parallel
Read Parallel

Enabled

Read Parallel

GamepadModeSwitchKeyCode

Read Parallel

KeyboardModeSwitchKeyCode

Read Parallel

MaxDragAngle

Read Parallel

MaxDragTranslation

Read Parallel

MaxForce

Read Parallel

MaxTorque

Read Parallel

MinDragAngle

Read Parallel

MinDragTranslation

Read Parallel

Orientation

Read Parallel
Read Parallel

ReferenceInstance

Read Parallel
Read Parallel

Responsiveness

Read Parallel

RunLocally

Read Parallel

SecondaryAxis

Not Replicated
Read Parallel

TrackballRadialPullFactor

Read Parallel

TrackballRollFactor

Read Parallel

VRSwitchKeyCode

Read Parallel

WorldAxis

Not Replicated
Read Parallel

WorldSecondaryAxis

Not Replicated
Read Parallel

Methods

AddConstraintFunction

Parameters

priority: number
function: function

Returns

GetReferenceFrame


Returns

RestartDrag

()

Returns

()

SetDragStyleFunction

()

Parameters

function: function

Returns

()

SetPermissionPolicyFunction

()

Parameters

function: function

Returns

()

Events

DragContinue

Parameters

playerWhoDragged: Player
cursorRay: Ray
viewFrame: CFrame
vrInputFrame: OptionalCoordinateFrame
isModeSwitchKeyDown: boolean

DragEnd

Parameters

playerWhoDragged: Player

DragStart

Parameters

playerWhoDragged: Player
cursorRay: Ray
viewFrame: CFrame
hitFrame: CFrame
clickedPart: BasePart
vrInputFrame: OptionalCoordinateFrame
isModeSwitchKeyDown: boolean