DragDetectors [Beta]

I figured that might have played a factor in the problem. I’m wondering why it’s recommended for the developer to request network ownership and assign network ownership as the solution? It sounds like a lot of boilerplate every time I want to use RunLocally. Shouldn’t that be the job of the DragDetector?

4 Likes

When you say “Dragging from the front” are you talking about standing so that the hinge is horizontal in front of you and trying to “lift” the door?

If so, I have bad news and I have good news. The bad news is, yes, it’s wonky. It’s just like if you try to rotate a Roblox Studio Rotate Dragger ring when it is edge-on: it moves incoherently.

This is something we can and will fix, in time.
Here’s what’s happening: imagine a DJ scratching a record. That’s how our RotateAxis drag detectors work. But when you are edge-on, the points that your finger traces on that circle all collapse into a line and you can’t work with it any more.
The fix is to treat the edge-on case special. We move it as if you stroked your hand along the edge of the record. The action is more like a rolling pin or rolling a hoop.

6 Likes

That is a really great idea, but there may be an issue with security.
Network Ownership can only be transferred on server scripts, not local scripts.

But if we do this automatic behavior you suggest, then during a game, anybody could run a local script to create a DragDetector and set it to runLocally. Then, basically they have a local script that can steal network ownership while they are operating a DragDetector, without needing to get server permission.

5 Likes

I personally was thinking of the DragDetector automatically requesting ownership of the part only if RunLocally is set to true. The server would validate if there’s a DragDetector with RunLocally set to true and give ownership as long as the part/assemblyRoot has SetNetworkOwnershipAuto (meaning it wouldn’t conflict with the developer assigning the network owner manually).

A player touching a part can give them ownership of the part, why not using/dragging a DragDetector that the server has? I think that’s the main question I have in my head.

7 Likes

More good points. I will check this out with the security experts here at Roblox and investigate.

9 Likes

it work i have sides made and it canot out it


i have seen a bug the axis reset when i herstart studio

1 Like

here is a video where you can seen my first drag detectors creations

I hope you enjoy my creations

video description

In this video i show you my drag detectors creations drag detectors are a new (beta) function on Roblox for now it work only in studio idk when it will work on Roblox check the dev forum for more information

©2023 happy games studio,s

---------------------------------------links---------------------------------------

Website happy games studio,s: removed link i think not that it can here because it us a link to my website but idk which links i can place here

Model sliding wall:
https://create.roblox.com/marketplace/asset/13544639781/slidingwall

Model desk with drawers and stuff in it:https://create.roblox.com/marketplace/asset/11124093431/beuro

Model puzzle:
https://create.roblox.com/marketplace/asset/13757666510

About drag detectors dev forum:
DragDetectors [Beta]
(This link bring you to above :slight_smile: )

Have a nice day and :vulcan_salute:

6 Likes

the full release is close? i really want to publish what i was working on this days

5 Likes

Wow this is awesome! You got the sliding puzzle working and you are our first creator to make a full video presentation like this with DragDetectors!
Congratulations on some nice work, @foodeggs7

I noticed that your last sliding block got stuck.
It looks like it didn’t drag in a fully straight line and it got stuck against a corner.
There are 3 things that might help here:
[1] I think you are using TranslateLine for your DragStyle, but if you are not, you could switch to TranslateLine from TranslatePlane (and then adjust the Axis property to point in the direction of motion).
[2] I think though that you are using TranslateLine, with a non-anchored part in Physical ResponseMode. So! You can set the DragDetector.ApplyAtCenterOfMass to true. Then when you drag, the forces will be applied at the center and not at the point where you click; the result is that the part will move in a more direct line. After this, I doubt it will be aproblem, but if your block bunks into something, it could still get rotated out of alignment, in which case you may want to add [3] below.
[3] If this still doesn’t do it, you could add a Prismatic Constraint to keep it moving only in a line. This is harder because you need to add an attachment to the moving part and an attachment to a fixed part; make sure they both lie on the same line with respect to the motion you desire; make sure that the X axes of the 2 attachments are both pointing in the direction of motion; then add a Prismatic Constraint; then set the constraint’s 2 attachments to be the ones you just created.

5 Likes

You mentioned a bug with axis resetting. I watched your video but couldn’t tell exactly what you did between editing the axis and then going to the game page and hitting edit. But it looks like you maybe did not save and publish the game first?

Have you figured out what was wrong or are you still having a problem with this?

2 Likes
  • I have celobrative editing enabled for that place so he sall automatically save

  • i have clicked save after change but after restart he still reset

  • i have done a restart test with the atachments but here it svae the axis just

  • i have tried set the axis with a script but then i get errors

  • i have done the atachments but then the moving part run away
    Screenshot 2023-06-12 09.09.07

3 Likes

I gave SetDragStyleFunction a whirl tonight and ran into a few issues. Let me explain what I was trying to use it for first. I tried to use it to position a draggable object in front of the character at all times. The script positioned the object in front of the character’s head if the player was in third person. If the player was in first person, the object would be positioned wherever their mouse is on the viewport. In most circumstances, that’d be in the center of the screen. Here’s what the script looked like:

local DISTANCE_FROM_CHARACTER = 4

local dragDetector = script.Parent
local draggablePart = dragDetector.Parent

local currentCamera = workspace.CurrentCamera
local currentGuiInset = game:GetService("GuiService"):GetGuiInset()

local function shouldUseHeadAsOrigin(): (boolean, CFrame?)
	local cameraSubject = currentCamera.CameraSubject
	if cameraSubject then
		local isLockedToHead = cameraSubject:IsA("Humanoid")
		if not isLockedToHead then
			return false
		end
		
		local currentHead = cameraSubject.Parent:FindFirstChild("Head")
		if currentHead==nil then
			return false
		end
		
		local currentCameraFocusPosition = currentCamera.Focus.Position
		local currentCameraPosition = currentCamera.CFrame.Position
		local isCameraInFirstPerson = (currentCameraFocusPosition-currentCameraPosition).Magnitude < 0.75
		
		if not isCameraInFirstPerson then			
			return true, currentHead.CFrame
		end
	end
	return false
end

dragDetector:SetDragStyleFunction(function()
	local shouldUseHead, headCFrame = shouldUseHeadAsOrigin()
	if shouldUseHead then
		return CFrame.new(headCFrame.Position + headCFrame.LookVector * DISTANCE_FROM_CHARACTER) * headCFrame.Rotation
	end
	
	local currentMouseLocation = game:GetService("UserInputService"):GetMouseLocation() - currentGuiInset
	local viewportCursorRay = currentCamera:ViewportPointToRay(currentMouseLocation.X, currentMouseLocation.Y)

	return CFrame.new(viewportCursorRay.Origin + viewportCursorRay.Direction * DISTANCE_FROM_CHARACTER) * currentCamera.CFrame.Rotation
end)

All the DragDetectors in this post use RunLocally.

Mysterious DragStyleFunction Parameter

The first issue I ran into was that I had no clue what parameters were passed to the DragStyleFunction from the docs and from studio’s intellisense. The only hint that it passed down a parameter was this part from the documentation:

it receives the signal’s world space cursor ray

Which in itself is a bit vague. It mentions the cursor, but from what I saw, it’s not the same as what I did with my DragStyleFunction for the viewportCursorRay variable. It’d be nice if there was a small explanation of what the parameter really is. In addition, a simple example function that could be passed to SetDragStyleFunction on the doc site that shows off that parameter would be handy as well.

Missing AlignOrientation for Scriptable DragStyle

I was messing around with the draggable object that used the code above and I noticed that the orientation of the object didn’t match what I was giving through my DragStyleFunction. I was heavily confused because the docs said this about the CFrame that the function returns:

it returns a CFrame containing the desired location and orientation of the pivot in world space

After a bit of investigating, apparently no AlignOrientation object is created when using a Scriptable DragStyle plus the Physical ResponseStyle. The Geometric ResponseStyle works as expected, so this definitely looks to be unintentional. Here’s what it looks like:

As you can see, the part with the Geometric ResponseStyle always has the red face pointing towards the character, like it’s supposed to. However, with the one that has the ResponseStyle set to Physical, it doesn’t do anything with the orientation.

Stuttering with Geometric Dragging in First Person

When dragging an object with the ResponseStyle set to Geometric, the object stutters since it’s being CFramed after the frame has been rendered, leading the object to being always a frame behind position wise. With this ReponseStyle, I don’t think this should be happening. Here’s a quick look at that:

Unexpected Positioning

When using the Geometric ResponseStyle, the object is positioned at the CFrame I returned with my DragStyleFunction (as seen in the video above), like I expected. However, when using the Physical ResponseStyle, the object rarely seems to be positioned correctly, if ever. I’m not sure what exactly is going on here. Here’s what that looks like:

In that video, I would expect the starting drag point to be where the cursor is. At the end though, you can see the cursor be on the opposite side of the part where the drag originated. No clue if that makes sense. The DragStyle being used here is the same as earlier (scriptable with the snippet at the top).

The DragDetector does indeed have ApplyAtCenterOfMass enabled in that video. However, with or without it enabled, I still get unexpected results with where the object is ending up.

Constraints Remaining after Dying

If a player is dragging a DragDetector when their character respawns, the AlignPosition and AlignOrientation constraints aren’t cleaned up until a different player tries dragging the object. There’s also some kind of desync when the ResponseStyle is Geometric (the client has it frozen but the server doesn’t).

This means if a player dies while falling and dragging an object, the object has the potential to be stuck floating in the air and out of reach.

6 Likes

Hmm. I must admit I am not super acquainted with all the details about saving and publishing. But I don’t think that collaborative editing automatically publishes your creation, it just saves it for Team Create in Studio. I did some testing and it seemed that way for all changes to the game. Are you seeing different behavior for changing the axis than for say duplicating a block?
If you click “publish to Roblox” I would bet that your changes make it to the published game.

What is the error you get when you try to set the axis with a script?
(You shouldn’t have to do this. You should just need to re-publish. But I’m curious what error you are seeing).

Attachments and constraints are very tricky to get right, unfortunately. Without seeing your example it’s hard to guide you how to use them. But also you probably don’t need them, you probably just need to set “ApplyAtCenterOfMass” to true like I mentioned in the prior message.

3 Likes

Thank you @YasuYoshida this is amazing and detailed feedback.
I will take some time to go through all this (hopefully today) and post a complete response.

5 Likes

See my reply to the original announcement, just below this one. We are not leaving the beta period yet, but you can sign up to have us turn on DragDetectors in your published game.

3 Likes

@WooleyWool @IAmPinleon @nlsnjr you may be interested in signing up for the DragDetector “beta for Places” below.

4 Likes

@here
@here Greetings!

Some of you are eager to try out and share DragDetectors in your games.
Even though we are still in beta, we can enable DragDetectors for specific published games.

So we are going to let you try it out.There is a link to a form below, but before you sign up, please be aware:
THINGS ARE GOING TO CHANGE. YOUR GAME MAY BREAK IF YOU DON’T UPDATE FOR CHANGED API. AND ASPECTS OF BEHAVIOR MAY CHANGE/IMPROVE.

Also: WE WILL NOT ENABLE YOUR GAME UNLESS YOU USE YOUR USERNAME IN THE FORM, NOT A GROUP NAME, AND THAT USER ALSO LIKES THIS REPLY
This is because some sneaky folks tried to get us to turn it on in other peoples’ games. Tsk, Tsk, Tsk. So we are going to check that the requestor is a valid owner or developer of the game.

Here is a list of issues you’ll need to consider. It will also help you understand what we hope to accomplish before we change from beta to a full feature release:

  • Add and Remove Constraint API signature will change and may break my code
  • In Geometric Mode, all nonanchored parts in a model will be anchored when moving, not just the clicked part
  • Behavior of constraints that control non-anchored objects may change slightly
  • Simulated collision behavior may be added to Anchored objects in Physical Mode, and to NonAnchored objects in Geometric mode.
  • runLocally may automatically request network ownership
  • Non-anchored objects may throw on release (instead of merely dropping) even in Geometric mode
  • Other bug fixes reported in beta feedback are coming; they will not likely effect gameplay

If you are comfortable with all of that, here is a link to request that we turn on DragDetectors in your published game:

P.S. We have enabled DragDetectors in “DragDetectors TestWorld 1” and “DragDetectors TestWorld 2

32 Likes

Yes! Thank you, this would be an awesome addition to our new game!

4 Likes

i have tried it with publich but he reset the axis by restart

and the eroor is this
Screenshot 2023-06-13 12.35.55

2 Likes

Add and Remove Constraint API signature will change and may break my code

Which code can it break scripts for things for the game or only drag detector script

  • DragDetectors TestWorld 1 - Roblox nice things made i have test itmin mobile and it work the second worldx have I’m not tested yet

  • In my Obby would i use my creations it are levels what i publiche later because there already levels before they not publiche but i made an teleport screen so people can test that levels and in the future you can play

how you made in the form that you must select things

I has worked with Google forms in the past for that people bugs can report to me via a broke site but I’m never saw that that can (i has not can use them because me account store was full ) you cannot fill in it but maybe I will made a new on other acc and set a link in my cominity but idk of i can people sent to it and I can tell jow they come there

EDIT i have test the second world but where are the towers for

4 Likes