[help] Direction of orbit depending on entry

MerkinMerkin Member, PRO Posts: 17
edited February 2016 in Working with GS (Mac)

Howdy,
Currently pulling my hair out, I know I am missing something simple.
Basically I have a rocket that I launch towards a planet, the rocket can launch at any angle and the planet can be at differing angles and starting points from the rocket. I can get the rocket into orbit smoothly and that works well, I can even get it to orbit in both directions. But the problem I am having is when to decide which orbit direction to take depending on the angle/side of the planet the rocket hits.
Any help would be greatly appreciated, I can provide more info if this wasn't descriptive enough.
I am also using Force = (Gmass1mass2)/r^2 to bend around other objects, but can't get into an orbit using this, so I am using different logic to enter the orbit.

This diagram is just to show how the planets could be positioned relative to the rocket and the changing angles of the rocket.

Comments

  • MerkinMerkin Member, PRO Posts: 17

    Ok, I solved it.
    Was messed up because the rotation of my rocket was off by 90 degrees.
    So basically when I collide with the 'atmosphere' I check the value of self.rotation + 90 and if it is greater or less than vectorToAngle( game.planetPositionX - self.Position.X , game.planetPositionY - self.Position.Y )
    And orbit accordingly.

Sign In or Register to comment.