- Home /
object smooth orbit around another object depending on mouse drag
I have special objects that can each be dragged freely around in 2d.
The objects cannot get too close to other objects (minimal Vector3.distance allowed is 1.5f).
I also have special connectors, which I can apply freely between 2 of any of these special objects. once 2 objects are connected, dragging them is further restricted.
The 2 objects cannot get too far between each other (max Vector3.distance allowed is 5f).
Both of these restrictions work, my issue is that once these restrictions occur, the objects are pretty much just stuck in place until dragged away from the restriction they tried to pass.
I want the object being dragged to orbit smoothly around the object it's connected to, once they reach any of the 2 restrictions.
The best example I can think of is the angry birds slingshot,
that once it reaches it's maximum pullback, you can just orbit along this max distance smoothly up or down depending on where you are trying to drag, this same smooth effect needs to occur both when too close and too far.
Hope I explained myself thoroughly I tried to find answers and try myself but could not reach any working solution.
thanks,
mman1235
Image provided is very inaccurate to the boundaries of each restriction, just to make it seem more clear.
[1]: /storage/temp/71522-orbit-plans.png
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Rotating around to a point 1 Answer
Detecting largest surface area of multiple collider overlap 0 Answers