okay,
my char class is a bit too complicated, and don't want to spend 2 hours cleaning it, so i will instead talk about the class Animatable : Obj
this class has a base object, including actor, mesh and skel.
once you have used create(Object &obj); with your object, you will have the class populated with all proper var according to that object ( meaning, skel of the object, meshes of the object, base actor... )
I normally have my main class, containing an animatable obj ( you could use it as parent as well but i believe that to avoid unexpected behavior like return false in a update to not make my whole class delete itself, it is better to separate them)
all you need to do is call the virtual Bool update(); and return true as long as you want it to exist. it should do all the behaviour by itself, as expected.
using the
// get / set
virtual Vec pos ( ); // get position
virtual void pos (C Vec &pos ); // set position
virtual Matrix matrix( ); // get matrix , returned matrix is normalized
virtual void matrix(C Matrix &matrix); // set matrix , 'matrix' must be normalized
function, you can change its position, or matrix, its as easy as it sounds.
here is an example on how to move the pos and rotate of the actor using the matrix:
obj.matrix(Matrix().setRotateY(angle+PI).move(pos())); // my model is facing off, so i add PI to make it straight
all you need is a way to handle the angle, which normally you would use mouse input in a FPS, else it could be a direction if you use point and click. obviously in a fps, you want X and Y to be rotated.
for the position its the same idea, you can register key, have your var speed * time.rd() according to your camera.orn matrix.
Now the animation:
AnimationFlt += time.rd(); // this can add slow or w.e you want
obj.skel.updateBegin(); // begin update
obj.skel.clear();
obj.skel.animate(SA_Idle, AnimationFlt, 1.0f , true);
obj.skel.animate(SA_TurnRight, AnimationFlt, flt_Turn_Right , true);
obj.skel.animate(SA_TurnLeft, AnimationFlt, flt_Turn_Left , true);
obj.skel.animate(SA_Walk, AnimationFlt, flt_Walk , true);
obj.skel.animate(SA_Run, AnimationFlt, flt_Run , true);
obj.skel.animate(Mot_Ability, true); // for combat animation
obj.skel.updateMatrix(obj.matrix()); // update skeleton animation matrixes
obj.skel.updateEnd(); // end update
there all you need is populate the correct SkelAnim, and flt blend anim ( this is to avoid jitter in the animation, normally i blend 0 to 1 with Lerp, i normally do the most static to most animated animation, as blend will work on previous set animate i believe.
hope that helps