DragDetectors [Beta]

I’m not familiar with how Lumber Tycoon’s draggers work. Can you describe how they move and react to mouse input? Or provide a clip that shows the behavior that you like?

1 Like

Cool! You, know, if you unanchor it and constraint its center to a point floating in space, you should be able to spin it and have it keep going. There’s an example in “DragDetectors TestWorld 1”

1 Like

It’s not a drag-and-drop replacement for any system you might have that uses draggers for the classic “select something and then get a rotate/translate/scale tool that edits it”.

I do believe we can build things like it over time; there’a toy prototype move tool in “DragDetectors TestWorld 2” but it is just a hint so far.

1 Like

I saw that there’s event .MouseClick, .RightMouseClick so that means we don’t have to add ClickDetector when we want to have let’s say Crates that is openable and draggable?

2 Likes

It essentially works just like in this video. If I recall also, it was affected by weight, so when you went to the store and tried to put a really big box on the counter to buy it, it was more difficult than dragging on a smaller one.

1 Like

if you were to click a loose object it would move the part around in a circular area around your avatar, position being somewhat controlled by the camera and start location

ive somewhat mimicked it, but still got some fiddling to do

3 Likes

MouseClick and RightMouseClick are inherited from ClickDetector, so you can also use those events. I used RightMouse click in a line editor to delete the point I was working on, for example.
I’m not sure what you mean by making Crates openable and draggable though. Maybe you mean like the door unlocking example we were discussing in this thread?

1 Like

It’s hard to guess exactly what you mean, but it sounds like using DragStyle = TranslateViewPlane might get partway there.

1 Like

yeah, that is what im using, but when looking down or using first person the part slowly drifts into space

1 Like

Hmm :thinking: I wonder if a hacky system like this could be recreated using this new feature. Thoughts?

I guess I’ll give it a shot.

4 Likes

Can you post a video of what looks wrong, and try to describe what you’d like to see happen instead?
If you look down, viewplane is parallel to the ground, so it would move away.
Is the idea that you want it to move always in a vertical plane, but the plane should shift with your point of view?

if that’s what you are after then this script might help. It sets the plane of motion to always be vertical, but in the direction you are looking; kind of like viewPlane except always tilted to match world vertical.

local dragDetector = script.Parent.DragDetector

dragDetector.DragStart:Connect(function(player, ray, viewFrame, hitFrame, clickedPart, vrInputFrame, isModeSwitchKeyDown)
	-- select the vertical plane most perpendicular to the viewPlane
	local look = viewFrame.LookVector
	local x = math.abs(look.x)
	local y = math.abs(look.y)
	local z = math.abs(look.z)
	local yVec = Vector3.new(0,1,0)
	local screenX = yVec:Cross(-look)
	local foo = screenX:Cross(yVec)
	dragDetector.Axis = foo
\
	dragDetector:RestartDrag()
end)

When you use the above, if you look straight down then the motion plane is a sheer wall which may be weird. So you can use this version to swtich to the ground plane when you are looking down:

local dragDetector = script.Parent.DragDetector

dragDetector.DragStart:Connect(function(player, ray, viewFrame, hitFrame, clickedPart, vrInputFrame, isModeSwitchKeyDown)
	-- select the vertical plane most perpendicular to the viewPlane
	local look = viewFrame.LookVector
	local x = math.abs(look.x)
	local y = math.abs(look.y)
	local z = math.abs(look.z)
	local yVec = Vector3.new(0,1,0)
	if y >= x and y >= z then
		-- use Ground Plane instead
		dragDetector.Axis = yVec
	else
		local screenX = yVec:Cross(-look)
		local foo = screenX:Cross(yVec)
		dragDetector.Axis = foo
	end

	dragDetector:RestartDrag()
end)

Does any of that help?

2 Likes

Let us know how it goes. You may want to set DragStyle = Scriptable and then write a method that always returns a CoordinateFrame that is facing the avatar and positioned right in front. There’s an example of registering a scriptable dragStyle in the DragDetectors tutorial page and also in “DragDetectors TestWorld 1”

2 Likes

Alright! Thanks so much for your insane amount of activity on this post and all of the assistance you’ve provided to the community. On behalf of all of us, we appreciate it - it’s not something you see every day from staff members. :smile:

I’ll let you know how it goes!

5 Likes

Uhm what I meant is like Crates that is openable when clicked and draggable when being drag by the mouse input. So you can basically do that without putting ClickDetector? If it is wow that is some convenience…

2 Likes

It’s a great feature, I can’t wait!
I tested it out, it’s awesome!
When do we expect to have this feature available in a published Roblox game? Right now it’s only available in studio.

2 Likes

They want to make sure they get alll the feedback and all bugs are fixed, so I would expect it to come for middle June/July but I can’t give an exact date and I’m not a Roblox employee so I can’t know for sue but it’s just my estimate

2 Likes

Basically like the example I needed?
Basically you can unlock the door and then you can drag it around a hinge?

3 Likes

It’s a beta release so it is understood that there would be bugs. I say we just throw it in, that’s when all the bugs come out.

2 Likes

Again, remember to search to see if your question has already been answered before asking. :smile:

2 Likes

Thanks, that’s very nice of you to say.

I will keep coming back here as long as you keep asking questions and hope you will spread the knowledge and help others.

You are the first people trying this feature. If I help you use it to its full advantage, I’m hoping that you will pass it on.

7 Likes