Sorry doqkhanh, but I didnt started extending the animation class, because I dont need it at the moment... but the code should give you a detailed explanation how to enlarge the class with other animations. The only problem I see is, that for more complex and smooth animations it will be really hard get good results. Theoretically it should work, but if you want complex periodical animations, your functions getting very complex out of sinus and cosinus... I also thought about a better method, over motion capture with two webcams. Maybe I will try this solution if I get more time.
This was exactly what I wanted to ask. The non-closed-circle animations like putting a pistol out of a holster and pulling a switch will be kinda problematic. This may need some extra keyframe-array algorithm. I implemented your class in my project two days ago, but currently I`m in exam session in the university, so I`m in a lack of spare time. One of the things I spotted was that you`re not calling AnimateJoints(); anywhere. I was wondering how do you set those variables for the animations? You animate the dude in Blender, write down some intersting values and add them to the code, right?
I would be very thankful if you suggest me a way of exporting similar model from 3dmax8, since I have problems with Panda and kWexporter or sth alike. The first messes the rigging and the second misses the materials.
As far as I understand the principle of the example is that we set one value and use a variable, changing another one`s value in sinusoidal curve, causing the oscilation around the first value, right? If we change the animation we call sth like interpolation, where the stand animation is the default or "zero" animation. That`s fine, but if we wanna have a large variety of animations it will be harder to check if this then do that. What may be implemented is sth like a function for universal smoothing between the animations. Sth like:
Code: Select all
//in the beginning of animateskel();
if ( lastplayedanim!=currentanim && ready=0) BlendAnimation();
Where BlendAnim() will get all the bone rotations from the last step and those for the current step and in some time ( 1sec for example) will manage to blend those rotations. This way the code will be better and we won`t have to go back to stand animation and interpolate to the next animation then.
Sorry if I had misunderstood sth, but I really took one really fast look at the code. I love it, since it gives me the freedom I needed, but as usual some things have to be improved to make it much better.
So keep it up, buddy!
![Wink :wink:](./images/smilies/icon_wink.gif)
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."