DragObject Damping

I found this script on the Unity wiki, DragObject, and it works like a charm - in fact its exactly what I was looking for. However, I would like to have the ability to, when moving the object, the object moves at either a constant speed or dampens to the position. Right now I can click and drag and move my mouse rapidly and it follows it at the same pace.

Any suggestions on how to implement damping and/or constant speed to this?

I'm currently try to do a similar thing as you've done, but I don't quite follow how you fixed this issue. I've got a main menu for people to join the game or leave by making use of the new Player Input Manager. This all works fine, but when I start the game and switch to a different scene I want to instantiate the amount of players that have joined again. The issue I'm facing is that all the amount of players that have joined only work under one controller instead of staying binded to their own controller. Do you have a good idea on how to fix this issue?

2 Answers

2

Maybe I’m misunderstanding, but it appears that the script you are using already has that functionality - if you change the “moveLimit” variable, it should cap the movement speed of whatever you are dragging to some value, even if the mouse is moved very suddenly/quickly in a particular direction.

If it follows your mouse at the same pace now, then the default value of 0.5 might be too high. Try out some smaller values for this and see if you get the behavior you are looking for.

By gosh, you are absolutely right… how the hell did miss that variable?!

Is there a way to delete this?

Thanks! I corrected the code.