You need to implement and instance a class derived from IAnimationEndCallBack.
Here's a quick and dirty example :
Code: Select all
class AnimEndCallback : public IAnimationEndCallBack
{
public:
void OnAnimationEnd( IAnimatedMeshSceneNode *node)
{
printf("The animation has ended!\r\n");
// Your callback code goes there.
}
};
[...snip...]
AnimEndCallback *animEndCallBack = new AnimEndCallback();
walkCall->OnAnimationEnd(light);
light->setAnimationEndCallback(animEndCallBack);
light->setLoopMode(false);
animEndCallBack->drop();
In case you're wondering, the problem is that you're declaring an uninitialized pointer to a virtual class, and you pass that uninitialized pointer to be called back later. Best case scenario, your pointer is initialized to NULL and nothing will happen. Worst case scenario, the random value assigned to
walkCall actually maps to accessible memory, and the code summons Cthulhu.
UPDATE : Updated the derived class creation method to use new as CuteAlien suggested.