- Home /
Re-joining relative orbital position after being removed
HI all,
I have a basic solar system with planets orbiting a sun in circular paths. The planets can be clicked on and dragged away and out of position. When they are being held, their orbiting script is turned off. However, when released they snap back to the position they were grabbed at.
However, I would like to have them Slerp to their relative position (i.e. where they would be if undisturbed and continue to orbit as normal).
Any ideas on how to achieve this?
Thanks in advance.
Answer by Ckboyd89 · May 10, 2016 at 08:57 PM
Perhaps you could have a parent GameObject that performs the orbital rotation. You can unparent the planet when you start dragging it around, and have it move back to the parent when released. Finally, when the planet comes within a specific threshold distance of the parent GameObject, you could reparent and snap it back into the zero offset local position.
That sounds like a good plan - will give it a try. Thanks! :)
Your answer
Follow this Question
Related Questions
Rotate camera outside of movement lerp? 0 Answers
Rotate, pan and zoom camera lerp touch 0 Answers
Mouse Orbit snapping issues 0 Answers
How to increase an int (or float) smoothly over time? (Mathf.Lerp?) 3 Answers
Scale Object Using Lerp? 2 Answers