Jump to content

  • Log In with Google      Sign In   
  • Create Account

2D skeletal animation - hints needed


Old topic!
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.

  • You cannot reply to this topic
1 reply to this topic

#1 bluman   Members   -  Reputation: 100

Like
0Likes
Like

Posted 15 April 2012 - 12:57 PM

Hello,
I am currently writing a 2D skeletal animation framework and currently I am a bit stuck on a few things.

a. How should I manage overlaps? Currently the bones are represented in a tree structure, but I have to write my way through sprite overlaps. For example a man should have the torso and the two hands. Should I simply make a priority flag for each bone and on rendering push the bones in a min-heap based on that flag or is there a smarter way? I saw this feature on an application called Demina and it seems very easily done, at least from the GUI I see.

b. Could you please recommend me a file structure to save the bones and their position at certain keyframes? Also should I separate the standing position and specific animations or should all be in the same file? Please do not just say use XML or something like that. I was thinking about naming each bone and saving a pointer in another structure called node for each bone in a hash and for each child that I load from the file just to add it to it's father in constant time, but I think this is a little too complex and would generate much memory overhead.

Thanks in advance,
Paul Herman

Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 7512

Like
0Likes
Like

Posted 17 April 2012 - 06:19 AM

Keeping bones in memory(file):
0. bone data consist of name/id and its parent bone id/name
1. save all bones to a simple array.
2. for each bone, save the parent bone index
3. sort the bone in the array by a topological sort (adjust the parent bone index accordingly)
4. this way you can process the bones in order and it is ensured, that when you process a bone, that the parent bone has already been processed

Bone/animation format
1. save the bind position, weights in the mesh file. This way you can use one animation/rig for several meshes
2. write one animation file, all keyframes are written in a sequence
3. save meta data like 'idle=frame 1-100, run=101-145,loop ' etc.
4. for each frame:
4.1 for each bone
4.1.1. save a timestamp, a rotation matrix/quaternion, a position relative to its parent bone




Old topic!
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.



PARTNERS