# move toward object and transition to circling around it.

While it's easy for me to get a object circle around another and move toward it, i've got a few problems I couldn't find a solution to, yet.

Ill go here as follows: I) description of scenario II) problems I currently have

I) Description: My setup consists of multiple things:

1) I have a solar system - basically some planets rotating around the sun in a fixed circular motion with the sun itself unmoving. This one works fine - I currently do it with rotateAround in Unity, but I read into force related methods and I think I'm able to get it designed with forces if needed.

2) Space ships. These ships are either circling around a planet (kind of "i'm stationed here") or moving toward another planet (to station them somewhere else) The movement towards a planet as well as the circling around the planet for itself is easy as far as im concerned.. just some move-toward-point stuff or rotateAround point again. I could those 2 implemented with forces too.

II) the problems I have.

1) I can't get my head around a smooth transition from flying toward a planet into the rotation. My first idea was to use some kind of states for the ships "CIRCLING" and "FLYING" and change the state as soon as the desired orbit height is reached. (btw: I use a 3d environment but for the gamelogic I only require the motion to happen on 2d x-z axis only, if this is important to you). The problem with this is, that it's kind of a 90° turn and really looks bad.

2) the next thing i had was to just add another "Transition" state, when I get close enough, which will handle the smooth movement into the circular motion, but I don't know how to do it.

3) Do I have to care for anything else because the target I want to rotate around is moving itself? (so it doesn't look like they speed up when moving around the planet in same direction of the planets movement, while seeming extra slow when moving against planets movement)? (I ask this, because currently I only work with static planets to get the ships movement correct)

So basically my question is: How can I implement this transition? (I don't care if it is a statebased approach with directly applied position changes (with relation to time for constant speed) or if I have to use rigidbodies and forces or if you come up with something else.)

and as an addition: I also need the ships to avoid planets when travelling somewhere - so I was thinking about using the steering behaviour for collision avoidance, which in my understanding would work well with a force based approach, but I didn't completely wrap my head around that yet. (I don't want an answer to this part here, but wanted to provide you with a more complete specification of problems, which has to be possible to mix into the approach without hacking something together badly ;)).

thanks for any help, advice, links to useful resources :) kind regards

• What is your goal? It appears that you want (and expect) to have a solution that looks and feels like real orbital mechanics but is somehow simple to implement. That is a no-go, start to finish. Orbital mechanics actually IS rocket science; and everything will have to drive from the forces. If your goal is a simple implementation, stop thinking that it will somehow look realistic. Commented Dec 29, 2017 at 13:16
• I feared that this would be the answer... Often enough there are simple enough ways to simulate something, that works fair enough to look kind of realistic that is simpler than the actual physical thing but wouldn't be good enough for precise physical usecases. I hoped that this applies for orbiting objects and the transition between flying somewhere and orbiting. If that is not the case, I will have to dive deep into the science behind it then, which is not what I wanted but what I will have to do ;) It does not have to be 100% realistic - my current transition however is a instant 90° turn.. Commented Dec 29, 2017 at 14:30