Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 16 December 2012 - 04:49 PM
Posted 16 December 2012 - 05:10 PM
Posted 16 December 2012 - 09:44 PM
Edited by RoyP, 16 December 2012 - 09:46 PM.
Posted 16 December 2012 - 10:25 PM
Posted 16 December 2012 - 10:30 PM
Inspiration from my tea:
"Never wish life were easier. Wish that you were better" -Jim Rohn
soundcloud.com/herwrathmustbedragons
Posted 17 December 2012 - 09:07 AM
That's the problem. I don't know the math. I'm sure I can learn it, but it's probably been 15 years since I did that level of math and I just can't remember how to do it.NoAdmiral:
If you think about it, your sprites have a point in each corner, which you are rotating around another point. The math to get those corner points to rotate around the center-point (or the rotation point) is the same that you can use to rotate any number of arbitrary points about an axis. I've never used XNA, but if you can view the code for rotating the sprite that should be a pretty good clue of what to do.
Posted 17 December 2012 - 09:25 AM
Check out my new blog: Morphexe
Posted 17 December 2012 - 10:41 AM
Edited by RoyP, 17 December 2012 - 10:42 AM.
Posted 19 December 2012 - 06:43 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.
Please help me understand the process and the math.
Posted 21 December 2012 - 03:58 AM
Thanks, mate. I don't know how to work with matrices yet, but this experience has taught me I need to learn linear algebra. So that's what I'm focusing on right now. I appreciate the help.
Roy
Posted 21 December 2012 - 01:41 PM
Thanks, mate. I don't know how to work with matrices yet, but this experience has taught me I need to learn linear algebra. So that's what I'm focusing on right now. I appreciate the help.
Roy
Basic matrix math is not so bad once you jump into it. There's some good websites that will teach you the basics of setting up a rotation matrix, transforming positions and direction vectors, and stuff like that. Any time you start moving objects around the world, having parent-child relationships, etc, you're into the realm of matrices... so that's the point where you should put everything else down, move matrices up to the top of your todo list, and learn them.
Once you have a basic matrix class and change your code to use them (whether you're working in 2D or 3D), it'll make your life much easier. It's like trying to dig a hole with your hands instead of using a shovel.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.