If what you want to do is drag an unanchored part as if it is anchored, you can set
DragDetector.ResponseStyle to be Geometric.
This will anchor at the start and unanchor at the end when it is done, so you get more close tracking of the object to the cursor.
If your goal is different, can you explain what you are trying to do?
RestartDrag() i this instance may not be enough to get what you want; it’s not really designed to handle changes in the object you are dragging; it’s more to handle reconfiguration of the DragDetector instance itself.
Whenever you add new features, there is always a “discoverability issue” and so often you must guide your players to discover new capabilities.
Signs like this are a great way to do it.
Did you check out the cool Dentist Obby game? They gave some good visual clues to help people understand what they need to do. Like, it starts with a little train in the first room with a big hand icon that you can push back and forth; then the first obstacle is very similar and you need to slide it to open a door. Once you establish that, people know how to move things. It’s very nicely designed:
Turns out I forgot about collision groups, I was trying to get an anchored part to have physical behavior by unanchoring it when its first dragged. The part needed to be anchored to avoid colliding with items on the shelf.
Collect all coins to buy a gift what be a decoration in a new game next year about a professor who lost in the universe build a fort to survive the creatures
New year obby can you play now I will the level for this year made with dragdettectors too
Check the last level @PrinceTybalt I made a seat that you need to drag forward @0Shank made this working
Hi @PrinceTybalt happy new year I have for this year level from my new year obby made a puzzle maze with dragdettectors if you will test I can give you admin commands to play this level with !TpCheckpoint 23 there only some bugs I will fix 2024-01-02T19:00:00Z
For some reason, setting the DragFrame from a script doesn’t put the object where it should be, but only for the first handful of changes after it’s dragged? If I tween the DragFrame, it ends up where it should be, but appears in the wrong place for a handful of frames at the start of the tween.
I don’t think I quite understand the question-- do you mean dragging so that the object tracks the mouse immediately, and it drags in the plane of the viewport?
If so, you can try setting the DragDetector to Geometric ResponseStyle, and TranslateViewPlane DragStyle.
We’re excited to announce that we’ve added a new feature to DragDetectors regarding permission controls!
You will now be able to easily set a Drag Detector’s drag permission to allow everybody, be disabled for everybody, or allow a drag on a case-by-case basis by registering a permission function.
The permission function will be given a player and an optionalPart as the argument. The player will be the player attempting to drag, and the optionalPart will be the part that was clicked on. Returning true will allow the drag to continue, and rejecting for any other outcomes.
Note that the part may be nil when dragging through dragFrame changes.
Is there a way to limit this movement on to 1 axis e.g it can only move 10 studs on the Z axis and collide with other objects?. I had a way but the object would start rapidly shaking when at the max distance. Or would it be better to make a custom thing for that?
If you try to set the DragFrame for a DragDetector on a part that is anchored, it should move to match. If that’s not happening, please provide steps or a place file so we can look into it and fix it.
If you try to do this for a non-anchored part, it won’t work. This is a known issue and we do have a bug open to fix this.
Hi @KingBob,
To make a DragDetector translate only along one axis, change the DragStyle to be TranslateLine.
Then, if you want to move on the Z Axis instead of the default Y axis, set the dragDetector.Axis to (0,0,1).
If you want to limit the motion between, say 0 and 10, then you want to set the MinDragTranslation = (0,0,0) and the MaxDragTranslation = (0,0,10)
But you also need to set the ReferenceInstance if you want to use MinDragTranslation and MaxTranslation. Set this to be the object whose coordinate system you are measuring in.
For example, if you set the ReferenceInstance to be game.Workspace.Terrain, the measurement will be in worldspace. If you set it to be some marker object, then it will be relative to the pivot of that marker object, and the direction will be the z-direction of that object’s pivot.
If the part is not anchored, then it should honor collisions when doing this. If the part is anchored, though, it will not pay attention to collisions.
As you can see in the video it starts to rapidly shake for no reason and I don’t know how to fix it. All I am doing is changing the axis whenever I press e I think it might be something to do with the align orientation however I need that to keep the part rotated correctly as it is not anchored and I need collisions. Would there be any way around this?
I assume you are changing the axis with a script.
In order to help you troubleshoot, or to see if DragDetectors have a bug, can you either upload an rbxl file, or print the contents of the script in a reply? If you want to leave out the part that draws/updates your arrow feedback you can, that probably is not related to your motion issues.
Hi @PrinceTybalt for my egg hunt event I used dragdettectors by one of the parkoers (hide somewhere underground) I made roots what you need to drag only the last is dififecult to almost not dragable in some way able as you come close to it
Attached is a version that I think works nicely.
I really didn’t see the shaking you did, but there were other issues I cleared up.
First, you really shouldn’t anchor something if you want it to work with physics. You’re cheating the system and collisions won’t work.
What I’ve done here is:
[1] removed your code that anchored the part.
[2] added an AngularVelocity constraint to stop the part from rotating
[3] added a remoteEvent that requests network ownership for the server; added a server script to grant it; and I fire that even upon DragStart. This is necessary because you have runLocally set to true. if you use the default of false, the server takes care of getting network ownership right.
[4] moved the RestartDrag() in your dragStart callback to occur after you change the axis; and removed the unnecessary RestartDrag() from your dragEnd callback.