Hello Creators!
We are excited to announce the release of DragDetectors! DragDetectors are a new instance type designed to make interacting with objects easy for everyone. They enable easy mapping of cursor/dragging actions to intuitive motions in 3d space. They can be used for anything that requires physical manipulation, like opening doors and drawers, pushing parts around, or grabbing and tossing a bowling ball.
Making a game of Jenga has never been so easy!
DragDetectors are highly customizable. You can choose from a wide array of drag styles, set directions and limits, and define how objects respond to the motion. DragDetectors work with anchored objects (will stay where you leave them) and unanchored objects (will apply physics as you drag and when you let go) so you can create the perfect interaction for your experience.
Furthermore, you can script against DragDetectors, using the movement to create additional mechanics like a light dimmer switch or a gear shift. You can even carry things âLumber Tycoon Style.â
How to use DragDetectors
There is an extended DragDetectors tutorial page here. And full API documentation here.
But read on to get started quickly!
To use DragDetectors, add a DragDetector under any part or model in Explorer. Hit Play and you will be able to go into the experience and start interacting with that object!
Customization of DragDetectors happens through properties. Click a topic to see documentation, or scroll down to see some examples.
- DragStyle - choose between different kinds of translations and rotations
- Drag Directions - choose directions and axes of motion
- ResponseStyle - choose whether physics is in action while you drag
- Axis/Movement Limits
- Physics Response
- Modifier Input
- Replication
In addition, you can use event connections and methods to customize DragDetector behavior, build 3DUIs, and perform game logic.
Examples
Here are some examples of what you can do with DragDetectors. Each of these is available as a model in the Toolbox, so feel free to play with them and modify them in Studio!
Example #1
Hello World!
It takes 2 steps to create a draggable part and 1 more step to play with it:
1. Create a part
2. Add a DragDetector as its child
3. Click Play
Now you are in a game with your draggable part!
To find a premade version, look for âHello DragDetectorâ in the Toolbox.
Example #2
Playing with Anchored and DragStyle
DragStyle changes how you translate or rotate when you click and drag.
- Create two draggable parts, one anchored, and one unanchored
- Create two parts.
- Make one anchored, the other unanchored.
- Add a DragDetector below each part.
- Change DragStyle of both DragDetectors to TranslateLine and click play:
- The anchored part moves up and down and stays where you leave it.
- You can lift the unanchored part and when you let go, it falls back down.
- Try exploring other DragStyles like RotateAxis, TranslateViewPlane, and TranslatePlaneOrLine.
- Remember to exit play mode before trying a new DragStyle. Changes to DragStyle made on the client wonât replicate to the server; so the change wonât stick.
To find a premade version, look for âAnchored and Nonanchoredâ in the Toolbox.
Example #3
New Script-Free Gameplay
Now you can build drawers that open and close, adjustable mechanisms, and balls that can be tossed or rolled, all without scripting.
DragDetectors using TranslateLine DragStyle and translation limits help make a working desk. To try this model, look for âDesk With Drawersâ in the Toolbox.
Add a DragDetector under a default sphere and set up 10 skinny blocks. Throw some texture on it and lower the pin density, raise the ball density, and you have some rudimentary bowling action. Our version is under âStick Bowlingâ in the Toolbox.
This works even better if you search the Toolbox for a real bowling set model, import it, and insert your own DragDetector under that bowling ball.
Models, Videos, and Worlds to Explore
Models
In addition to the models in the examples, the models used in the introductory video clips may all be found in the Toolbox. If you filter(the button to the right of the search box) for Creator = PrinceTybalt, you will find: Marionette, Slingshots, Slingshots WithReloadScripts, Jenga, Jenga Throwable, and Particle LineSlider. Thereâs also a âLumber Tycoonâ style example called âLift and Carry: Physicalâ that employs some more advanced scripting.
More models will be added over time, so check back.
Videos
Also, we will be making a series of instructional videos, Here is the first âHow to Build a Jenga Game in 3 Minutes With DragDetectorsâ, and there will be more to come:
Create a Jenga Game in minutes with Drag Detectors
How To Create A Sliding Door With DragDetectors
How To Create A DragDetector that Only One Player Can Operate
Worlds
Lastly, there are three worlds we are sharing with you. We have used the first two for prototyping and QA testing. They exercise all the features of DragDetectors, many of which are not covered here.
The worlds are published and you are free to download, inspect, alter, copy, and reuse as you like. Go to the link, click ââŚâ near the title, then Edit to open them in Roblox Studio, then File->Download to save your own copy.
This third world has some variations on âLift and Carryâ style dragging in the spirit of Lumber Tycoon. These employ scripting DragStyles, client and server scripts, and RemoteEvents to achieve a more advanced result.
Whatâs next?
We canât wait for you to try DragDetectors and let us know what you think. Weâve also collected some great feedback during our beta period. Here are some features we may add (no promises!) based on this early feedback:
- Screen Gui & Viewport Frame
- ScreenGui/SurfaceGUI: we know you miss âdraggableâ on 2DUI elements. We want to make it so that if you put a DragDetector below ScreenGui object like a button or text label, then you can drag it, complete with all the callbacks and API; you just wonât be able to bring it out of the plane.
- ViewportFrame/WorldModels - we hope to make it so that DragDetectors work in this context just like they do in the main view.
- Security Control: a property named PermissionPolicy with 3 values: Nobody, Everybody, or Scripted. If scripted, you may register a method dragDetector:SetScriptedPermissionCheck(function(player, part) that returns true if the player may drag the part, false otherwise.
- Better Physics Integration:
- runLocally should automatically get network ownership for non-anchored objects they drag
- add new Collision response style. This will collide anchored objects and allow a way to move non-anchored objects geometrically, but with collisions
- throw non-anchored objects on release even in geometric mode
Finally, many people helped us launch this feature. In particular, Iâd like to thank @Urukeli, @DeFactoCepti, @PolarPorcupine, @Slim_Fandango, @IgnisRBX, our amazing QA team, and all the other people throughout Roblox that helped shape this feature to work nicely with the other parts of the Roblox ecosystem.
Thank you!