Hey all, I've had a few minutes since Chance came along and started back to work on some of my projects. One of these is a 2D Skeletal Animation Package (lets you create 2D sprites and then animate them easily). To achieve this I'm using the standard Joint and Bone mech.
Now though I have some problems, I can't seem to find out how to perform proper translations and rotations based upon the other "Nodes" in the system.
You can view the source Here (Rather then post the entire thing in the forum) and here is a sample of the desired output:
Basically the node at the top in green is the root joint (Joints don't have to have bones, but bones must have end point joints). From their I have a "Bone" moving on a downward vector (X:0, Y:1) etc, etc...
When rendering I take the root joint, walk its bones and their joints recursively and place the items on the screen. The idea is you would call Translate(X, Y) or Rotate(Degree) and this would set the FRelativeValid flag to false, upon reading the RelativeTranslation or RelativeRotation it calls CalculateRelative (only if RelativeValid = false) and then returns the calculated values (as well as sets privates for later use to lower recursion and overhead). I should then be able to plot the RelativeTranslation point to the screen directly (minus any world transformations).
What code should be in CalculateRelative?
If I'm completely on the wrong track please SPEAK UP! I have no clue what I'm doing and their are few if any good articles on the subject. This can't be rocket science as I know that others have done it in 3D, I just want to do it in 2D.
Thanks ahead of time.
Bookmarks