DragDetectors [Beta]

We’ve discussed this before, I think in the main announcement. There is code that specifically prevents this for ClickDetectors, and DragDetectors inherit that behavior. I need to make sure there’s not a good reason for this before changing it.

2 Likes

Wow this worked first try without anything, it even stopped me from shooting my weapon when dragging.

2 Likes

Just wondering if there’s a way to force a player to begin dragging an object?

2 Likes

Can you describe more fully what you are hoping to do?
What might be the sequence of events?

2 Likes

I want to be able to call a method on a DragDetector using a player as a parameter that would cause the player to begin dragging the model, whether they are holding down their mouse or not

2 Likes

This is not something you can do.
How would you know where to move the object without mouse rays? Are you saying you want them to start tracking the mouse without pressing it, and then stop at a particular time?

2 Likes

I want to be able to call a method on the client to basically simulate clicking an object, then it will trace the mouse whether the client is holding down left click or not

1 Like

Decided to try out DragDetectors. Have to say that the amount of thought and polish that went into them is very much appreciated. Very well done, love the feature.

3 Likes

There’s some issues with that, like how would it work cross platform (e.g. mobile and VR)

1 Like

This would be useful for making building tools.

2 Likes

DragDetectors are built to work on mobile and VR. On mobile, you can drag a DragDetector with touch; in VR you can use the virtual laser. They should behave the same as with keyboard and mouse.
The exception is the DragStyle “BestForDevice”: this used TranslatePlaneOrLine with keyboard and mouse; TranslatePlane for mobile; and for VR it does 6DOF motion at the end of the laser

3 Likes

If I make the DragDetector BestForDevice would that give VR users an advantage over mobile or desktop users?

1 Like

@0Tenth yes it could, because VR users can move things more freely,. But it depends on the situation and application of your game.
Also I should mention:
Mobile device users have a different advantage: they can use multiple fingers to move more than one DragDetector at a time!

3 Likes

Found another use case for this feature

image
(I am unable to drag the lemon as it is covered by the water)

I want to implement my own click-and-drag detection system, as the current one cannot be customized as far as I know. This create some issues as I cannot drag objects by clicking through CanCollide off and semi-transparent objects, for example, water made with parts, the smooth terrain water, or forcefields

For mobile, I think you could pretend they are still holding down where ever they last pressed, and for vr users it could just trace their hand whether they like it or not. Alternatively, you could also allow us to kind of “simulate” the click-and-drag input of users (eg. by calling a method from the client like :SetDragTarget(Vector3))

1 Like

Can you make the water not collide with the default CollisionGroup? AFAIK the cursor is under the Default collision group

That does not solve the issue of wanting to have my own custom click detection system to code specific filtering behaviour instead of having to rely on collision groups

Set your water’s CanQuery property to false and the DragDetector will ignore it. You can customize the draggers by creating and setting a custom drag function.

If I set the CanQuery of my water to false, then it can’t be hit by raycasts or other spatial queries. And my issue is not the behaviour of the DragDetector, I am already aware of the ability to set a custom drag function. What I want is to be able to make a custom filtering system.

Anyway I decided to just give up on using DragDetectors and created my own dragging system with AlignPosition and AlignOrientation so that I’d have control over everything

@MintSoapBar
[Edit oops you already discussed this above. leaving this here so others can see the method anyway]

You can make it so that you can click through some parts to get at DragDetectors. The secret is collision groups. The ‘pick ray’ used by DragDetectors, like the one used by our standard draggers, belongs to the default collision group. You need to create a new collision group that does not collide with the default collision group, and add your object into that group.

To do this:
[1] open the collision group editor
[2] create a new collision group called ‘ClickThrough’
[3] open the table view in the collision group editor. Uncheck the box in the row ‘default’ and column ‘clickThrough.’ This makes it so that the pickRay can not collide with your object. (I don’t know why setting canCollide false doesn’t give you what you want).

Here is an image of the setup:

And attached is the file that shows the behavior. You can click through the big square to drag the long rectangular part.
ClickThroughPart_ToDrag.rbxl (54.2 KB)

1 Like