However, anything I have tried so far has been unsuccessful, and I have looked a lot on the internet for solutions but it seems I am either bad at expressing myself or it’s not a common thing to do, or it’s just that it needs a different solution/approach.
If you apply the example to the object which is rotates around the other object, then after moving the other object, the rotation recovers.
If you want to move them together, you have two options:
make the rotating object child of the other object, this case the move together is automatic
then you move the other object, you move the rotating object as well with the same translation (calculate the vector from the original position to the new position and apply it to the rotating object)
Parenting is not an option here, I need the child to be separate.
I have looked into this some more and it looks like the InverseTransformPoint() is something that could be used for this, but I tried and it didn’t seem to work…
Basically what I am after is a way to get the position of an orbiting object when it stops orbiting and keep the positional offset to the object it is orbiting around when it stops rotating. I have spent hours looking for something like this and have found a lot of near-solutions, but sadly nothing that can solve the situation.
What I have so far is this, which is based on the code from the above URL:
(This solves another issue that a lot of people seems to be having with clamping RotateAround, and this is without expensive calls to cross/normalisation.)