It took quite a while because I was busy with other things and because I tried to do too much at once. Once I broke the problem down into smaller pieces, things quickly fell into place. I had to rewrite most of the underlying bones and joints but I eventually got the skeletal animation to work with actual graphics. Here's a half-sized Galamoth from C:SOTN.
I completely got rid of bones and just use FlxSprites now. Each FlxSkeletonJoint is responsible for how the parent and child are positioned relative to each other. Joints do this by attaching the "ball" point of one sprite to the "socket" point of another at a given angle. Each joint can still have it's own set of animations. The FlxSkeleton itself just holds the bones and joints and helps assemble and detatch them.
Next is basic inverse kinematics - just enough to support things like "look at that" or "put your right hand here". That should be good enough for what I need.
Showing posts with label Flixel. Show all posts
Showing posts with label Flixel. Show all posts
Tuesday, November 22, 2011
Monday, November 14, 2011
Skeletal animation with basic physics
Skeletons are now FLxObjects and not FlxGroups. There's a few other minor changes but that's the big one. You can see the bounding box by toggling debug mode by pressing [~] then clicking the bounding box icon in the upper right.
Press [w] to jump, [a] or [d] to walk, hold [shift] to run, and [k] to kill yourself. There's not really anything to do here - just jump around and self-kill when bored.
Press [w] to jump, [a] or [d] to walk, hold [shift] to run, and [k] to kill yourself. There's not really anything to do here - just jump around and self-kill when bored.
Completed this time:
- Make sure skeletons play well with Flixel physics (collisions, velocity, acceleration, etc.)
- Detaching bones (exploding skeletons!)
- More animations for HumanoidSkeleton
Next up:
- Make sure regular sprites and animated sprites can be used as bones
- Constraints for joints
- Ragdoll physics
Friday, November 11, 2011
Skeletal animation with forward kinematics
I'm off to a good start with my little detour into skeletal animation: I've got bones and joints that can be animated. The joints use keyframes to hold the target angle of the joint and interpolate between the current angle and the target angle so switching animations should smoothly transition from one to the other. I had a bit of difficulty since rotating a FlxSprite rotates about the center and I need to rotate around the joint. I also wasted nearly an hour on a really stupid bug where animating a joint would sometimes make it freak out (hint: -45 as a Number and -45 as a uint are two very different values). Once I'm done, I plan on submitting a pull request to the original Flixel project so maybe the next version of Flixel will support skeletal animations....
Done so far:
To do:
Done so far:
- FlxSkeletonBone - a FlxSprite with a start and end point
- FlxSkeletonJoint - a class that connects bones at an angle
- FlxSkeleton - a FlxGroup that wires everything together
- HumanoidSkeleton - a pre-made human skeleton with some generic animations
- Keyframe based animations per joint
- Simple forward kinematics
- Make sure regular sprites and animated sprites can be used as bones
- Make sure skeletons play well with Flixel physics (collisions, velocity, acceleration, etc.)
- Constraints for joints
- Ragdoll physics
- Detaching bones (exploding skeletons!)
- Add inverse kinematics
- More animations and helpers for HumanoidSkeleton
- Walking velocity determined by feet positions?
Subscribe to:
Posts (Atom)