DragDetectors [Beta]

It should be live in all games! You simply need to enable the beta feature in Studio to be able to add the DragDetector instance into your places.

4 Likes

Thatā€™s awesome! I recently made this game with my team for a gamejam as well! Reversed Mind - Roblox

4 Likes

It i already live for published games! Since last Tuesday.
Are you having an issue where you donā€™t see it enabled in your game?

4 Likes

Glad you got it working! When life gives you lemonsā€¦ make a Roblox game!
And, smart move to make use of the ray itself. Thatā€™s more efficient than what weā€™ve done prior referring to the humanoid to get a frame of reference. If itā€™s giving you what you need, very nice.

3 Likes

Cool game! I love all the beautiful visual effects and the red-cube-trails when recording. I got through puzzle 1 butā€¦ itā€™s a workday I canā€™t play more right now.
Are there DragDetectors in the later puzzles?

4 Likes

Hi @foodeggs7 I tried looking at your yellow puzzle in the file you sent, but when I hit play the pieces fall.
So you need to weld them together or something.
Is the problem you have is that you canā€™t drag then when they are welded, so you left them unwelded?
Is that whaā€™ts happening with your fan too?
Well there is a way around this. You can weld the part, but then when you want to drag it, you disable the weld in a dragStart callback and enable it again on dragEnd.

Iā€™ve attached an example world:
It contains a non-anchored blue part welded to an anchored red wall.
There is a prismatic constraint limiting the blue part to only move up and down.
And a spring connected to a little green ball just to show physics is active.

Most important for you isDraggingAWeldedPart.rbxl (57.0 KB)
a script that removes/restores the weld so you can move it, but it wonā€™t fall down when you are done:

local dragDetector = script.Parent.DragDetector

local weld = nil
dragDetector.DragStart:Connect(function(player, ray, viewFrame, hitFrame, clickedPart)
	weld = clickedPart.WeldConstraint
	weld.Enabled = false
end)

dragDetector.DragEnd:Connect(function(player, ray, viewFrame, hitFrame, clickedPart)
	weld.Enabled = true
end)

2 Likes

I recently deployed DragDetectors to my game and overall the feedback from my players has been very positive. However, Iā€™m running into an interesting bug with DragDetectors affecting some mobile users. This seems to only occur when the part is towards the left of the screen and the DragDetector is not detecting any input from the player.

On PC, hovering over the part allows you to see the cursor for dragging and more importantly it does allow you to actually drag. On mobile the dragging functionality in some cases (even without code behind it) appears to just not detect any dragging input.

All the reports weā€™ve had of DragDetectors being difficult or not detecting input is from mobile users. On PC the behavior is as expected.

External Media

4 Likes

The lower left section of the screen is reserved for navigation on touch devices.
Initially in our first implementation you could drag there, but then people would get in situations where the couldnā€™t move the character because the navigation area was completely covered by a DragDetector, which stole the events.

You can check if this is the issue by running the device emulator in studio:
[1] go to the test ribbon
[2] click ā€˜deviceā€™ and then from the pulldown over the center of the game view, pick a touch device like ā€œSamsung Galaxy S7ā€
[3] click play

If this is your problem then maybe you can design around it with a visual cue?
If itā€™s something different then maybe we have a bug to fix.

Are you in a situation here where the player cannot walk or navigate? If so it might be interesting to think about a way to override this behavior when navigation is not present; something we donā€™t currently support

3 Likes

We were planning on doing it, but it hadnt come out of beta yet.

3 Likes

Your response is greatly appreciated and this is definitely the problem. I completely forgot and oversaw the fact that mobile navigation uses that section of the screen. In my implementation the playerā€™s camera is manipulated and the player can not actually move, so perhaps a way to override the navigation there would be useful when using DragDetectors with a locked camera/position.

We will likely have to design around this for now, I think it should be easy for us to just move the camera a bit higher or to the left so that the left section of the screen is not interfering with our DragDetectors. Is this a solution you think is viable for now or was your ā€œvisual cueā€ suggesting something else? Open to suggestions about how to get around this atm!

3 Likes

Yes, if you can make sure that the DragDetectors you care about are outside that area you should be okay.

Weā€™ll also look into whether thereā€™s a nice way to disable this; but itā€™s not something that would come soon.

5 Likes

I has made it unanchored without welds and made with negatives a hole in the fan and wall but the shaft was not working so I has do it over with anchor the negatives but it only work to the first part in the second part of the shaft union you canā€™t go further how can I fix that maybe it holes are cant colide and the screws clitch out the wall so how can I fix that but the holes must be cancolide false to work with unanchored screws

And is there a way to use dragdettectors in a tool

3 Likes

How do i add this to the game to pick up logā€™s and parts? Iā€™ve gone on to the world to try it but I cannot seem to get it working.
Are there some good tutorials I can use please?

2 Likes

What would be the script to move it like you have freeform and then dropping down? Iā€™ve got an old ish version of a drag script but struggling to understand the new dragdetectors so i can migrate it to that.

2 Likes

I have already posted the code for my custom drag style function in my post

2 Likes

@MonsterStepDa Iā€™m really curious whether the script @MintSoapBar posted helps you and meets your needs.
Many people will be asking this question, and theirs is the simplest solution Iā€™ve seen so far.

Please report back? It would be great if we had a good, established answer for this question.

3 Likes

@foodeggs7 Iā€™m sorry but Iā€™m having a hard time understanding your issue in the first paragraph.
Can you isolate the issue youā€™re having into a small set of parts and post that with an explanation of how you expect it to behave?

As for toolsā€¦ DragDetectors arenā€™t really made to work with them. The motion of the tool is governed by its attachment to the hand isnā€™t it? (I donā€™t know a lot about tools to be honest).

What do you expect to be able to do with a DragDetector and a tool?
If others reading this also expected to be able to use DragDetectors with tools, Iā€™d love to hear your use cases as well.

3 Likes

I believe it should work now! Let us know if there are any issues.

3 Likes

good news and bad news.

good news first, one of the issues I was having is now fixed! before when I dragged the object that had limits on translation, the limits would stay in the position it was grabbed at (limits wouldnā€™t follow the referenceinstance) this doesnā€™t happen anymore and the limits follow the referenceinstance.

now the bad news is that when I back away or get close to the dragged object, it stays at the same position without accounting for the limits.
itā€™s better but still doesnā€™t fully work for me.

please let me know if Iā€™m doing anything wrong.
(object in the video has max set to X: 8, Y: 8, Z: 8 and minimum set to whatever distance the player was from the part when it was grabbed on each axis)

EDIT: did a bit of testing and another strange issue happens when grabbing the object from a closer distance. itā€™ll just fly to a far away corner from my player. (I know itā€™s happening cause of the max translation but itā€™s strange how it doesnā€™t happen when Iā€™m further away)

here I set the reference instance to the players head cause setting it to the humanoid wasnā€™t doing anything.

4 Likes

Ok

I have made a shaft with a fan by this fan you must drag screws out the wall

So I made with unions and negative a shaft but you cant walk in it I think the negatives not anchored

So I tried it again and now part 1 of the shaft work but part 2 not

I think it so in the fan so the screws clitch out the wall because it union negative not correct set

But the screws must unanchored and the holes must cancolide false

I will make a X bow so you drag a arrow and shoot it

But maybe that Bleu springs

3 Likes