June 21, 2008

animation system


I don't feel like making a new screenshot so here are some tulips instead.


This is a general overview of the way my character editor works.

To recap from my last post about aiming, all of the objects in the editor are nodes in a hierarchy. They are derived from a base class that I call TransformNode. The specialized nodes that I have so far are the Joint, IKHandle, and Quad. Joints are nodes that form a skeleton and can be affected by IK, IKHandles are nodes that control an IK chain (of joints), and Quads are the textured quads that make up the visible part of an entity.

All nodes contain a collection of attributes that are used in animation. The base node has translation and rotation attributes, and specialized nodes can add other attributes to the collection. The Quad, for example, has additional attributes for width, height, and texture coordinates. (This means that texture/sprite animation can be used in combination with skeletal animation.) New attributes are animateable as soon as they are added to the node and exposed to the interface (via a public property with get/set accessors so that they show up in the property grid).

Attributes are animated by setting keyframes in the animation curve that is associated with that attribute. A curve contains a set of keyframes and a reference to the node it affects, along with the attribute index. Keyframes contain data for control points on the animation curve and their tangents. The positions of the points on the curve are the frame of the animation (x) and the value of the attribute at that frame (y). Bezier interpolation is used to interpolate the values between keyframes. An animation is simply a set of curves.

Aim animations have an additional bit of data called an AimVector. It has minimum and maximum rotation values and is attached to a node in the hierarchy. Aim animations are like regular animations except that there are only two keyframes. When aiming, the angle of the vector between the aim vector node position and the target position is compared to the minimum and maximum angles to get an interpolation value. This value is used to do a linear interpolation between the two frames of the aim animation.

When exporting animations, the curve data is interpolated and values are saved for every frame in the animation (so that interpolation does not need to be performed in game).

This editor has evolved a lot over the time I've been working on it. I'm finally satisfied with this particular implementation, although a lot of the functionality was copied from Maya.

6 comments:

Unknown

Impressive again! Out of curiosity, this system will not let you change the speed of an animation in real-time right? So creating a walk and run loop will be two different animations or one that gets sped up? I'm wondering since I'm about to get into this.... (I hope soon, damn lack of time!)

Anna

I think that is something that would be handled by the actual game, not the animation editor. I don't know yet which way I'm going to do it, or if I'm going to make a distinction between walking and running at all. If I do, I would probably go with separate animations for walking and running that get blended together somehow using the variable speed of the character.

UPNPAD

This comment is kind of off-topic, but I'm not sure how else to contact you. It regards Soldat Polyworks and the Animated GIF image support in Soldat 1.5.

Would it be possible for you to add this feature to Polyworks? I realise you've stopped developing it, though there really is no Soldat map editor like Polyworks, and it would be useful if we could actually add Animated GIF's to our maps. Thanks again.

Anna

Well, it doesn't look like anyone else is going to do it, so I'll look into it. It seems like there is no easy way to load a GIF file into a DirectX texture in VB6 though. Animating it in the editor would be even harder. I'll see if I can come up with an adequate solution.

Anonymous

Hooray!

Anna

The thread for it is here. I've gotten lazy again with respect to PW but I will get back to it eventually.

Post a Comment