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:
  • 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

To do:
  • 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?

1 comment:

  1. Nice project. I would love to see some advance in your to-dos. Keep the good work!

    ReplyDelete