I am trying to create a function that will take a point, and a distance and give me a radon location in the circle in that distance.. example
SpawnPlanet(PlanetToOrbitAround, Distance 200 px) returns a point in the "circle" of that 200 pixels away from the planet.
I'm also looking for the actual rotation logic, so one I spawn planet I have a method
UpdateRotation(PlanetToOrbitAround, OrbitingPlanet, 200 px distance, 5 degrees of speed)
I'm terrible at math, I've found some examples and everything I find doesn't seem to work for me(probably because of my lack of understanding of the math involved). The rotation seems to work for a planet around a sun, but not a moon around a planet
public Vector2 RotateAboutOrigin(Vector2 point, Vector2 origin, float rotation) { return Vector2.Transform(point - origin, Matrix.CreateRotationZ(rotation)) + origin; }
is the logic I'm using.. with calls as such...
mPlanetLocation = RotateAboutOrigin(mPlanetLocation, new Vector2(GraphicsDevice.Viewport.Width / 2 - 25, GraphicsDevice.Viewport.Height / 2 - 25), .005f);
mMoonLocation = RotateAboutOrigin(mMoonLocation, mPlanetLocation, .005f);
The moon rotates strangely and oblong . Any help would be great!