Have you added support for dragging in mobile? When I drag it only moves the camera.
Itâs probably not supported for Mobile because itâs not supported for Games, so because Mobile canât access Studio it probably doesnât have access
At the moment, the feature doesnât work in-experience, so that means it wonât work for PCs as well. This is going to change when they fully release it though. As far as I am aware, there are properties related to mobile devices in DragDetectors.
Why are DragDetectors and ClickDetectors still using this cursor:
and not this one:
Also an option to set a key to rotate the object would be kinda nice.
DragDetectors are going to be really good for physics because they make it easy to simulate complex behaviors such as gravity, friction, and collisions.
I might be the only one saying this, but the pixelated one looks better
Possibly, but for consistency sake. I think it should be one or the other.
This looks amazing! I can see so many uses, like for use with picking up items and inspecting them, or for tactile switches and stuff. Nice to see that the touch interest code from 2008 is still being used. G3D era stuff!
I have three questions regarding control of physics and network ownership as those can give the client too much control over a model allowing for control over CFrame, Destroy, etcâŚ
Who gets priority over the physics and control of the object being dragged?
Who gets NetworkOwnership of the dragged object?
What were to happen if I were to reset the objectâs NetworkOwnership to null while it is being dragged?
Thanks in advance for the answers!
Thereâs nothing automatic.
You probably figured this out, but if you want to do script this, you can register two callbacks:
in response to dragStart, save the start DragDetector,.DragFrame
on dragEnd, launch a method that animates you back.
Far from automatic, but at least thatâs the only part you have to think about.
i am LITERALLY shaking right now how is this possible
Yes! Touch/mobile is covered!
The problem is, you cannot try it out yet because you cannot use DragDetectors in published games.
However! You can try it in the Roblox Studio simulator:
[1] go to the test ribbon
[2] click âDeviceâ
[3] from the dropdown in the main window, choose a touch device
[4] click âplayâ
[5] RESULT: now you are playing with the touch simulator.
You can test out how:
[1] Draggers only work if you are NOT operating the thumbstick, jump button, or other UI elements
[2] When you drag, the camera does not move
[3] There is an indicator circle that shows when you are click-dragging a DragDetector.
Also, something to look forward to: Here is @urukeli 's (who worked a lot on the touch features including multitouch!) demo showing multitouch:
We didnât bake in all the combinations as options for DragStyle because we didnât want a really long list. We can always add more if there are certain styles or combinations that people really love. But you can do what you want with a small script.
Here is a script that will let you change between any two DragStyles you like when the modifier key is pressed. Just set the locals âkeyUpStyleâ and âkeyDownStyleâ to the ones you want, and place the script as a sibling of the DragDetector. This one translates in a plane and when you hold the key it rotates about the planeâs normal:
local dragDetector = script.Parent.DragDetector
local keyUpStyle = Enum.DragDetectorDragStyle.TranslatePlane
local keyDownStyle = Enum.DragDetectorDragStyle.RotateAxis
local function updateDragStyle(dragDetector, isModifierDown)
if (isModifierDown) then
if (dragDetector.DragStyle ~= keyDownStyle) then
dragDetector.DragStyle = keyDownStyle
dragDetector:RestartDrag()
end
else
if (dragDetector.DragStyle ~= keyUpStyle) then
dragDetector.DragStyle = keyUpStyle
dragDetector:RestartDrag()
end
end
end
dragDetector.DragStart:Connect(function(player, ray, viewFrame, hitFrame, clickedPart, vrInputFrame, isModifierDown)
updateDragStyle(dragDetector, isModifierDown)
end)
dragDetector.DragContinue:Connect(function(player, ray, viewFrame, vrInputFrame, isModifierDown)
updateDragStyle(dragDetector, isModifierDown)
end)
Hello!
I just had time to try these, and theyâre very useful, but I found 2 things that could be made better, I might add things, so first:
You cannot use it with a ClickDetector
, probably this isnât something thatâs meant to be, but probably is just a âerrorâ and second it can pass trough anchored parts, if I simply put my cursor on a part itâll pass trough it, maybe there could be a setting like PassTrough
which would allow it to pass trough (maybe with CollisionGroups
)
Hi @mohammed1336,
Great questions!
Hereâs how it works: The server shoots the rays into the scene and decides what to do,. If it uses physics to move a part, it adds a constraint⌠which replicates to all players. Then it edits the target position of that constraint⌠which replicates to all players.
So, whoever has network ownership will do the physics and the physics system will propagate the PV (position/velocity info) to all other players and the server, regardless of who has that ownership.
This continues to work even if network ownership changes (although you will see a hiccup in motion as the adjustment is made)
And then when itâs done, the server removes the constarint⌠which replicates to all players.
Note that TODAY that constaint is an instance that you can see in the explorer. This will almost certainly change to use internal constraint methods prior to our final release, so that we are not adding/removing instances during a drag
Wait, does this mean itâll not work when multiple Players will try to drag it at the same time?
I also like how you explain how you create these things basically telling us how to make it ourselves
Hi @Dede_4242,
First, Iâd like to understand what you are trying to do with ClickDetector thatâs not working. Can you explain more fully what you tried to do? Maybe there is a way to do it if you tell me more.
DragDetectors are actually derived from ClickDetector, but they are separate things. You would use one or the other.
Second, regarding moving anchored parts through other things: yes others have suggested theyâd like this as well. Itâs not an easy fit with the way our physics engine works, but we may be able to find a way.
- I was basically trying to make a door which you would click and it would unanchor, after you could drag it with the DragDetector, I already tried to disable/enable it but it wonât work anyway, if you want the script:
local door = script.Parent.Parent
local clickD = script.Parent
local dragD = door.DragDetector
local function onClick()
door.Anchored = not door.Anchored
dragD.Enabled = not door.Anchored
end
clickD.MouseClick:Connect(onClick) --or what event it was called I donât remember
- You mean making it pass trough parts or adding the toggle?
Any one DragDetector can not be dragged by two players (or fingers) at the same time. Whoever clicks first âownsâ the drag until they let go.
We may add an option to change this in the future. It could be really cool if two people clicking opposite ends of something could either move by pushing in the same direction, or spin it by pushing in opposite directions. Teamwork! Or you could use two fingers on touch on the same item to move it, twirl it, etc.