DragDetectors [Beta]

alright i found a solution just use cc false massless and invisible dragdetector parts welded to the platforms, suits me enough

2 Likes

Are the cursor icons not yet implemented, or am I using them wrong? I recall the cursor changing icon earlier, and now, on hover and on mouse down, the cursor does not change. This seems unclear to me.

I noticed some additional issues.

image

After moving the pizza with the drag detector, the origin point does not change, as shown in the image.

Additionally, the .Changed property signal seems as if it is not firing due to positional changes of models with drag detectors. I am using .Changed on the client to detect movements in the pizza and simulate an environment within a viewport frame. If I move the pizza on the server with my studio tools, the pizza moves in the viewport. If I move the pizza with the drag detector, the pizza position is visually in the correct location on the server, but it is not updated within the viewport frame.

object.Changed:Connect(function(property)
	pcall(function()
		local value = object[property]
		clone[property] = value
	end)
end)

Here is an example:
DragDetectorTest.rbxl (59.2 KB)

2 Likes

How to set drag detectors so that it only can drag to left and right always and not you drag left later it cannot drag right only left further I have it now without limits but then you can drag it left and van so cheat becouse if you drag later it block your way so you must what you drag drag back

4 Likes

Hello! I’m loving this feature so far, but there’s one issue that’s blocking my specific use case. I have a Reference part and axis (and its limits) set, but if the cursor is dragged further down than intended, it snaps to the negative version of the limits. Is there a way to strictly enforce only one “side” of the rotation?

(Response is Geometric, Axis limits are -45 to 45)

RobloxStudioBeta_JO7AXTsBpk

3 Likes

Hi @SingleSided.

Thanks for the posting. I may not have time today but I will look into the issues you reported as soon as I can and write back.

3 Likes

I’m having a little trouble understanding what your problem is. Does this help at all?
It looks like your minDragTranslation is (0,0,0) and your maxDragTranslatino is (0,0,10) and your dragDirection is (0,0,1).
this would mean that you can drag to the right until the limit of 10, and drag to the left to 0 but no farther.

If you want to move to the left, you’d need to set your minDragTranslation to sometihng like (0,0,-10).

Does that help? If not maybe try to explain in more words and more steps exactly what you expect to happen that is not happening?

2 Likes

This seems wrong. I will look into it in the next couple of days and write back.
In the meantime, you might be able to get better results by registering your own constraint function. There are examples of addConstraintFunction in the “DragDetectors TestWorld 1” and “DragDetectors TestWorld 2”

3 Likes

Another question I have is, will there be any future work to make the drag detector drag objects onto a grid? When I say this, I mean they snap into position in certain stud sizes. sorry i dont know how to explain that well

3 Likes

Hi @emilaltg.

We didn’t make it a built-in constraint behavior, but you can do this with a small script that adds a constraint behavior.
Go to DragDetectors TestWorld 2 and hit “Edit in Studio”
Look for the 4 demos “RelativeGridAnchored” “WorldGridAnchored” and 2 named “RelativeGridNonAnchored” (oops, one should be named “WorldGridNonAnchored”

Each of these has a script that uses dragDetector.addConstraintFunction() to add a simple constraint that keeps it on a grid of 1 stud. The World version keeps it aligned to a world grid, the Relative one moves in even amounts of studs from the current location.

3 Likes

Regarding the icons, they are working for me in game when you hit Play or Start. But if you are in studio with the standard draggers (translate, rotate, scale, select) all disabled, so that events fall through to dragDetecrtors while in edit mode, it may not work on the mac. This behavior has been incosistent over time.

But attached
DragDetectorTest_withIcons.rbxl (59.5 KB)
is a version of your demo that has custom icons on your dragDetector, and it is working for me.

2 Likes

My post was intended to bring up 3 separate issues, the most important of which in my case would be the .Changed event not firing. My place file highlights an example of the .Changed event not firing for positional changes of the block. I hope you get to those soon.

It looks like your mention of icon behavior is correct. After testing my pizza sample, the icons seem to be changing outside of studio (in-game) but not working in studio (play test). I am not using a mac.
https://gyazo.com/5d707b03d0a4a0a0126769e7335920cc

3 Likes

Regarding the changed callback:
It’s working correctly. If you change the part to be anchored, then the dragDetector will be editing the cframe when it drags and you’ll see your output.
But when you the part is not anchored, we move things using physical forces. When physics moves an object, the position does update, but the changed callback is not invoked. (Google a bit and you’ll see this is well known).

If you change to a polling script, you’ll see through printouts that the position is changing in your example:
local part = workspace:WaitForChild(“Test”)
while true do
wait(0.2) – Wait for 200 milliseconds (0.2 seconds)
print("position = " … tostring(part.Position))
end

3 Likes

Lastly, regarding your pivot. I’m guessing that [a] your pizza geometry is inside a model and [b] Translate tool is showing you the pivot of that model and that [c] the model.primaryPart is not set.

If this is the case, then the model’s pivot will never update unless you explicitly set it.
But if you set the primaryPart to a part within the model, then the model’s pivot will update to match it as that part moves.

The attached DragDetectorTest_WorkingPivot has a fully fixed version, injecting a model above the part, setting the primaryPart, and adjusting the script.
DragDetectorTest_WorkingPivot.rbxl (60.1 KB)

3 Likes

Update: Thanks for reporting this. This is definitely a bug. And slightly embarrassing.

2 Likes

Super thankful you could shed some light on the issues I was having. Appreciate it!

2 Likes

FYI we’ve filed a bug on this and are looking into a fix now. It was also raised again more recently by @Astra_X2.

3 Likes

I’m happy to do so. Even if you don’t surface bugs we need to fix, it’s very helpful to know where you get stuck trying to make cool things.

4 Likes

As you seen om the start from the video it model must slide right and back to left it work with the min drag translation but you can pick it again to drag it further how can I do that it limited to left and right can without pick up can further dragging

1 Like

This is amazing, when will it work outside of rolox studio aswell?

1 Like

Aha. I think I know your problem. You need to set the DragDetector.ReferenceInstance to something that is not moving when the DragDetector moves. The minDragTranslation and maxDragTranslation are always relative to the referenceInstance’s pivot. If you don’t set it, the referenceInstance is the object itself, and so your limits are always relative to the object itself’s location; that’s why the limits appear to be changing every time you start a new drag.

3 Likes