New Animation Commands
I've built a modified version of ReepBlue's C++ animation manager class (based off my Lua script) into the engine. This adds a new command and eliminates the need for the animation manager script.
void Entity::PlayAnimation(const std::string& sequence, const float speed=1.0f, const int blendtime=500, const int mode=0, const std::string endhook="")
void Entity::PlayAnimation(const int index, const float speed = 1.0f, const int blendtime = 500, const int mode = 0, const std::string endhook = "")
The animation manager only updates when the entity is drawn, so this does away with the most common use of the entity draw hook. This will make the engine a bit simpler to use, and existing code will still work as before.
Usage in Lua
Although the animation manager script has been removed from the default scripts, you do not need to modify your existing projects.
The AI, weapon, and animation scripts have been updated to use the built-in animation manager. Previously these scripts would create an AnimationManager lua table and call it like this:
self.animationmanager:SetAnimationSequence("Idle",0.02)
These calls now look like this:
self.entity:PlayAnimation("Idle",0.02)
One-shot animations that call a callback when the end of the sequence is reached used to look like this:
self.animationmanager:SetAnimationSequence("Death",0.04,300,1,self,self.EndDeath)
Now we just pass the function name in:
self.entity:PlayAnimation("Death",0.04,300,1,"EndDeath"
Again, as long as you have the old AnimationManager.lua script in your project, your existing scripts do not need to be updated.
Animation callbacks are not yet supported in C++.
This update will be available later today, for C++ and Lua, on all platforms.
- 8
9 Comments
Recommended Comments