Hello devs. I would like to share with you the game we have been working on for a while now inspired almost entirely by Drag. I hope you like it and I congratulate you for the good work of these interesting new functions.
OMG this is totally awesome. You are coming up with new obby elements that I hope will become classics.
One suggestion: The blocks that you toss around might be easier to work with if you steal the script behavior from the âThrow It!â demo in DragDetectors TestWorld 2. If you use that, then the plane that you drag the block in will always match the plane you click on.
Oh thank you very much for your words! And thanks for the tip too Iâm trying it right now
@PrinceTybalt I see, it seems like the Coaster Tool Plugin is involved. When I turned off the plugin, DragDetector worked in Roblox Studio as well. When testing DragDetector, turn off this plugin. thank you very much. Thank you very much for helping me.
Iâm curious if you could implement the system you use in the âLift and Carryâ game into the drag controller, so itâs more easily accessible rather than having 150 lines of code for one draggable item.
Greetings, Gentlemen.
I Do indeed wonder how this new interesting instance works in code,
Is there any possible way to see the script of this object, I Might get some useful information from that.
In general, we prototype new built-in DragStyles by scripting lua examples. There are a few in the example worlds. One is the âLift And Carryâ (which as you see is a bit complex) and another very short one is âThrow-Itâ (which picks a new plane of motion when you click, so you move it parallel to the face of the cube. youâve clicked on; it gives neat control). The lua examples show you ways that you can create new behaviors and we hope you do.
We can always fold these in to be automatically provided, but [a] we donât want a super long list, and [b] we only want to do that with things we are certain are perfect for the behavior they promise. âLift And Carryâ is pretty complex, and not perfect, so we wouldnât add it until, at the very least, we have enough feedback that itâs high enough quality. Plus, if you look at the script, there are a bunch of parameters like CARRY_DISTANCE and 4 parameters to limit the range of motion. We wouldnât want to add the DragStyle without the controls, but we donât want to add 4 new Properties just to support that DragStyle. Providing the best API is all a balance of utility and elegance, and itâs not an exact science.
@yousefaaaaa097 the DragDetector is a new instance available as part of the engine. Itâs written in C++ and itâs not a lua script. We canât share the code, but weâre not trying to keep any secrets here beyond that. Feel free to ask questions, and here is a summary of the architecture behind them:
- First we watch for input clicks that hit the DragDetectorâs parent part or model. That input can be mouse, touch, gameController virtual cursor, or VR laser pointer.
- Then we map the motion of that input to virtual lines and planes to get a CFrame that specifies proposedMotion relative to where the object started. The lines and planes used vary depending on the chosen DragDetector.DragStyle. (TranslateLine, RotateAxis, etc.). And the result is a new translation and/or rotation. If the DragStyle is scripted, your own method (registered with SetDragStyleFunction) gets to pick that proposedMotion based on the cursorRay
- Before finalizing the result, the proposedMotion is given to any constraint functions youâve registered with AddConstraintFunction. Then the proposedMotion becomes the actual motion. Itâs multiplied by the DragDetector.DragFrame (which measures the DragDetectors motion relative to the ReferenceInstance) and the DragFrame property is set with the new value.
- Lastly, the DragDetector.ResponseStyle determines what happens next. If itâs Geometric, Anchored objects will have their pivot edited to move them; and non-anchored objects will be temporarily anchored for a similar change. If itâs Physical, Anchored objects behave the same but non-anchored objects are tugged around by hidden constraints. If itâs Custom, then nothing else happens. We donât move the object. So you can make buttons this way (like the ones I showed about 10 posts up), or things that watch the DragFrame and trace out new objects (like the âcreate cubesâ demos #22 and #23 in DragDetectors TestWorld 2).
- All the above is done on the server, in response to dragStart/dragContinue/dragEnd events that are sent from the client to the server. These events have the same parameters as the ones in the callbacks you get to register. If the DragDetector.runLocally is true, the client doesnât send events to the server, it just does the work itself.
(Edit: easy peasy. Just add 18 months work. )
@x_maks441 another user, @Sho_Takahashi, was having the same problem.
They solved it by disabling some of the plugins they had installed in their Roblox Studio.
Try disabling yours and see if it solved the problem?
Is there a way to cancel a drag in DragStart/DragContinue (e.g. if the character dies)? I could disable the drag detector I suppose, but want to know if thereâs a nicer way to do it that doesnât require tracking all dragdetectors in the world (i.e. simply disallow it at the time itâs invoked).
Also a note about the example, here if you donât add a case to use the rootpart instead of the head if itâs missing (custom characters), it will fall back to using the cursorRay which means players can drag objects wherever they can zoom out their camera to. This is also a place where I would want to cancel the drag instead.
(Technically you donât even need to use the Head part either, but some games do different things to the body parts in first person, so this is fine)
I believe the easiest way at the moment is to disable the dragDetector. That will terminate any existing drags on that dragDetector.
You could immediately re-enable it on the next line, and it should be ok.
An API to cancel drag on request is something thatâs been brought up many times though-- we will discuss if the current solutions provide enough, or if we need something more.
Please let us know if this works, and if you find cases where this would not be a desirable approach, let us know!
Some other niche behavior: moving the dragDetectorâs ancestry (its parent, or itself to another parent) will also terminate any existing drags.
If the character performing a drag respawns, the DragDetector should close out any drag that is in progress automatically. If you do not see this behavior, please give us details.
This doesnât happen when they die without respawning, because we want games to allow âghostsâ to drag things around if thatâs their desire.
If you want to disable at a particular time for a different reason, though, as @DeFactoCepti said, your easiest way is to set DragDetector.Enabled to false (and back to true if you like to clean up). And so I guess you have to write some kind of script to track which DragDetectors you care about. You can add some info to a list in a module during the dragStart() callback that registers the player and the dragDetector; and when players die you can check that list and disable the associated in-progress dragdetectors; then remove them from that list during a dragEnd() callback.
Thanks for the tip about the rootPart for the Lift-and-carry demo. Iâll update it on Monday!
i understand that having a lengthy list will be confusing, but i think the current system that the physical and geometric drag parts use in âLift And Carryâ would probably be the ideal outcome when you think of a DragDetector. Obviously, it wouldnât function as intended but it seems to be the most stable and probably preferred output, instead if having a cube being flung thousands of metres at mach 10 if you look too far right.
@xynxae try using the DragStyle âTranslateViewPlaneâ which translates the object parallel to the view plane. It doesnât give you the exact distance control of the lift and carry demo, and in 3rd person it doensât place the object in front of the character. But it does keep the object moving in a frontal plane whichever way you face.
I have set my dragdettectors world public come test my creations
Did you restart studio after turning off plugins? I already turned off half of my plugins and yet did not help
Is there anything printed in the output window? That helped us @Sho_Takahashi figure out when he had disabled the correct plugin because the unexpected output disappeared. I would turn them ALL off. You can always turn them back on.
I never got anything in output. Thatâs weird.
Right now going to test without any plugins on