2D bone system

I am trying to write a 2D Bone system in XNA.

My initial thought was to use matrices to track turns and position through a bone tree so that elements can be easily displayed.

Cool, I thought, and then horror hit me in the face when I saw that matrices can only be applied to a single instance of a .Begin sprite, not to a call to call!

I checked some performance tests to see if I had any horror, and this caused spritebatch.Begin and End when the number of frames dropped by my frame rate in a huge (and unacceptable) amount.

So, before I draw a single image of the bones, I will need to manually create its final position and rotation (and, possibly, the scale in the future). In this case, would you still use matrices and somehow extract the information at the end before you draw the bone? If so, what ideas on how do I get the final information I need? Or would it be easier to try to build all of this from the original positions and rotations of its parent nodes?

Thanks in advance to everyone who has ideas.

+4
source share
2 answers

Honestly, I would stop the Sprite rendering object and switch to square squares. There are no artificial restrictions for on-screen ATVs, and you can use the standard implementation of bone systems: move down the tree, applying transformations when you go, and then pop up when you move backward through the tree.

+4
source

Don't the matrices overflow when you work in 2D anyway? I mean 16 scalar multiplications for each matrix-vector product, when can you do 4 multiplications for rotation and 2 sums for translation?

0
source

All Articles