Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


#ActualRoyP

Posted 02 January 2013 - 12:13 PM

Let me try explaining exactly what I'm trying to do.  I might not be making it as clear as I thought.

 

Here's an image showing what I'm trying to do:

 

33ngf2t.jpg

 

The purple ship is the parent ship.  The orange ship is the child ship.

 

1 - I'm starting with a parent ship at (640, 320) in world space (center of the view port).  I set the child ship's position with an offset of (-47, -47) from the parent ship's position.  Both ships start with a rotation of 0 degrees (I convert all the degrees to radians with the MathHelper.ToRadians method).  The only thing I do with the rotation amount is to use it for the SpriteBatch.Draw call in the game's Draw method and use it to pass the rotation value to the Matrix.CreateRotationZ method.

 

2 - When I hit the right arrow, I want to rotate the parent ship 15 degrees clockwise and compute the new center point for the child ship in relation to the parent ship.  The goal is to have the child ship rotate with the parent ship while maintaining it's position within the fleet.  (My eventual goal is to turn the concept into a waypoint system so I can park different child ships at the waypoints.)

 

3 to 7 -  I need to repeat step 2 over and over again, so that the child ship keeps orbiting the parent ship while maintaining it's fleet formation.  I want it to orbit in a complete circle.

 

When I press the left arrow key, I want to do the same thing, but in the counter clockwise direction.

 

Does that make it any clearer?

 

I know that I need to use matrix transformations to do it, but I need help understanding how to actually do the matrix transformations.  I've never done it before and I need someone to walk me through it step-by-step so that I can learn what I'm doing.

 

I have a basic understanding of matrix and vector math, but I'm having trouble applying the abstract concepts to a concrete implementation in XNA.

 

Roy


#3RoyP

Posted 02 January 2013 - 12:12 PM

Let me try explaining exactly what I'm trying to do.  I might not be making it as clear as I thought.

 

Here's an image showing what I'm trying to do:

 

33ngf2t.jpg

 

The purple ship is the parent ship.  The orange ship is the child ship.

 

1 - I'm starting with a parent ship at (640, 320) in world space (center of the view port).  I set the child ship's position with an offset of (-47, -47) from the parent ship's position.  Both ships start with a rotation of 0 degrees (I convert all the degrees to radians with the MathHelper.ToRadians method).  The only thing I do with the rotation amount is to use it for the SpriteBatch.Draw call in the game's Draw method and use it to pass the rotation value to the Matrix.CreateRotationZ method.

 

2 - When I hit the right arrow, I want to rotate the parent ship 15 degrees clockwise and compute the new center point for the child ship in relation to the parent ship.  The goal is to have the child ship rotate with the parent ship while maintaining it's position within the fleet.  (My eventual goal is to turn the concept into a waypoint system so I can park different child ships at the waypoints.)

 

3 to 7 -  I need to repeat step 2 over and over again, so that the child ship keeps orbiting the parent ship while maintaining it's fleet formation.

 

Does that make it any clearer?

 

I know that I need to use matrix transformations to do it, but I need help understanding how to actually do the matrix transformations.  I've never done it before and I need someone to walk me through it step-by-step so that I can learn what I'm doing.

 

I have a basic understanding of matrix and vector math, but I'm having trouble applying the abstract concepts to a concrete implementation in XNA.

 

Roy


#2RoyP

Posted 02 January 2013 - 12:11 PM

Let me try explaining exactly what I'm trying to do.  I might not be making it as clear as I thought.

 

Here's an image showing what I'm trying to do:

 

33ngf2t.jpg

 

The purple ship is the parent ship.  The orange ship is the child ship.

 

1 - I'm starting with a parent ship at (640, 320) in world space (center of the view port).  I set the child ship's position with an offset of (-47, -47) from the parent ship's position.  Both ship's start with a rotation of 0 degrees (I convert all the degrees to radians with the MathHelper.ToRadians method).  The only thing I do with the rotation amount is to use it for the SpriteBatch.Draw call in the game's Draw method and use it to pass the rotation value to the Matrix.CreateRotationZ method.

 

2 - When I hit the right arrow, I want to rotate the parent ship 15 degrees clockwise and compute the new center point for the child ship in relation to the parent ship.  The goal is to have the child ship rotate with the parent ship while maintaining it's position within the fleet.  (My eventual goal is to turn the concept into a waypoint system so I can park different child ships at the waypoints.)

 

3 to 7 -  I need to repeat step 2 over and over again, so that the child ship keeps orbiting the parent ship while maintaining it's fleet formation.

 

Does that make it any clearer?

 

I know that I need to use matrix transformations to do it, but I need help understanding how to actually do the matrix transformations.  I've never done it before and I need someone to walk me through it step-by-step so that I can learn what I'm doing.

 

I have a basic understanding of matrix and vector math, but I'm having trouble applying the abstract concepts to a concrete implementation in XNA.

 

Roy


#1RoyP

Posted 02 January 2013 - 12:07 PM

Let me try explaining exactly what I'm trying to do.  I might not be making it as clear as I thought.

 

Here's an image showing what I'm trying to do:

 

33ngf2t.jpg

 

The purple ship is the parent ship.  The orange ship is the child ship.

 

1 - I'm starting with a parent ship at (640, 320) in world space (center of the view port).  I set the child ship's position with an offset of (-47, -47) from the parent ship's position.  Both ship's start with a rotation of 0 degrees (I convert all the degrees to radians with the MathHelper.ToRadians method).  The only thing I do with the rotation amount is to use it for the SpriteBatch.Draw call in the game's Draw method and use it to pass the rotation value to the Matrix.CreateRotationZ method.

 

2 - When I hit the right arrow, I want to rotate the parent ship 15 degrees clockwise and compute the new center point for the child ship in relation to the parent ship.  The goal is to have the child ship rotate with the parent ship while maintaining it's position within the fleet.  (My eventual goal is to turn the concept into a waypoint system so I can park different child ships at the waypoints.)

 

3 to 7 -  I need to repeat step 2 over and over again, so that the child ship keeps orbiting the parent ship while maintaining it's fleet formation.

 

Does that make it any clearer?


PARTNERS