I'm trying to figure out how to make a child object orbit around a parent object. In my situation, I'm trying to create a parent ship that rotates waypoints with it when it rotates. A smaller child ship will park itself in a waypoint to maintain it's position within the fleet.
Here are a couple of images showing what I'm going for:
The child ship must keep it's position relative to the parent ship so it maintains it's position within the fleet.
i've tried learning enough about matrices to do it, but I'm screwing something up. I've got my child ship orbiting the origin point of the screen instead of the parent ship.
Here's the code I'm using when I press a key:
parentShipRotationRadians += MathHelper.ToRadians(15);
childShipRotationRadians += MathHelper.ToRadians(15);
Matrix.CreateRotationZ(parentShipRotationRadians, out childShipRotationMatrix);
childShipPositionPoint = Vector2.Transform(childShipPositionPoint, childShipRotationMatrix);
How do I rotate the child ship's center point around the parent ship's center point with matrices?
Please break it down for me and help me understand what you're doing. I've tried researching it and I just can't find the info.
Roy

Find content
Male




