• Create Account

# RoyP

Member Since 10 Nov 2012
Offline Last Active Jan 23 2013 08:06 PM

### Need help getting a child object to orbit a parent object ...

01 January 2013 - 01:28 PM

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);

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

### NWA Game Developer Meetup -- December 29 -- Fayetteville AR

26 December 2012 - 09:49 AM

Interested in making video games and having fun?  Come join us at our next meetup on December 29th.

We're looking for people in Northwest Arkansas who are passionate about game development and want to learn more about it while working on fun game projects together.

We're not just for programmers.  We have members interested in game design, game programming, game art, game music and sound effects, level design, writing story for game development, and more.

It doesn't matter if you're an enthusiastic beginner or a seasoned pro, come hang out with us.  We'd love to meet you.

You can find all the details at our Meetup site.

### How do I rotate a group of child objects in relation to a parent object?

16 December 2012 - 04:49 PM

I'm working on a space shooter with a local team. We're building the game with C# and XNA 4.0. I would rate myself as an advanced beginning programmer.

I'm trying to rotate a fleet of smaller fighter ships in relation to a larger cruiser ship, like this:

I'm setting the position of the parent ship as an offset to the origin point of the map object. And then I'm setting the position of each child ship as an offset from the origin point of the parent ship.

How do I rotate the positions of each child ship in relation to the parent ship's rotation? I want the child ships to maintain their formation with the parent ship no matter what angle I rotate it to.

I'm not worried about smooth rotation or anything right now. Just trying to figure out how to transform the x and y positions to the new rotated x and y positions. I know how to set the rotation of each object.

### NWA Game Developer Meetup -- December 15 -- Fayetteville AR

09 December 2012 - 10:04 AM

Interested in making video games and having fun? Come join us at our next meetup on December 15th.

We're looking for people in Northwest Arkansas who are passionate about game development and want to learn more about it while working on fun game projects together.

We're not just for programmers. We have members interested in game design, game programming, game art, game music and sound effects, level design, writing story for game development, and more.

It doesn't matter if you're an enthusiastic beginner or a seasoned pro, come hang out with us. We'd love to meet you.
You can find all the details at our Meetup site.

### NWA Game Developer Meetup -- December 1 -- Fayetteville AR

25 November 2012 - 09:50 AM

Interested in making video games and having fun? Come join us at our next meetup on December 1st.

We're looking for people in Northwest Arkansas who are passionate about game development and want to learn more about it while working on fun game projects together.

Whether you're an enthusiastic beginner or a seasoned pro, come hang out with us. We'd love to meet you.

You can find all the details at our Meetup site.

PARTNERS