Update Position Walk Cycle MD5

Hello,



I am new to this but I'm trying to have a bunch of characters wander around a scene.  Right now I am able to import my models into the engine using kman's md5importer.  I am using Blender to create these models.



I also have an animationcontroller class that handles multiple animations for one model.  I am having problems updating the model's position after it finishes one "walk cycle."  I resorted to using bounding box centers to reset my position.  In my animation controller, when I finish a set of animations for a walk, I go back to frame 0.  I then want to reset the position of my model before starting a new walk cycle again:



if(frame == 0)

{

    BoundingVolume bv = this.agent.getWorldBound();

    Vector3f newPosition = new Vector3f(bv.getCenter().getX(), 0, bv.getCenter().getZ());

           

    if(bv != null)

          model.setPosition(newPosition);

           

}



This causes the animation to look choppy since resetting causes the model to moves a little more than it should.  I know there has to be better method than this.  What is the best way to update the model's position after a walk cycle?



Thanks a lot ahead of time!

I think the way most models do this is to walk on the spot in the animation, so when you move the animation around at the right speed it gives the illusion of walking… Thats how I did it.



If you couldn't correct your models, you could have a player sized box or a node location for your player, and at the start of every animation loop start an animation that is fixed at that location and faces the player. You could use TimedLifeController to restart this process, and keep the faceTo reasonably accurate.