Thanks for the replies. What I'm trying to do is make a reusable animatable object that I can setup from the editor.
I am avoiding the use of IDs directly in code and using the "findparam" function to find the id (for the imported fbx object and it's animation) of each parameter in the object_class (refered to as model and idle in the code).
So essentially I am attempting to retrieve the ID dynamically from the object_class assigned to the animated mesh object I want to import. the model and idle_animation variables are the things I want to contain the IDs to the respective files and pass those to the rest of the code to do whatever it needs to display an animated mesh.
I actually do have a 2.0 License
I found a struct class called Animatable but there doesn't seem to be any examples using it. Maybe I'm over looking something? Here's what I have after attempting to apply what you mentioned Esenthel. I think I found a few things that were wrong before and fixed them but the game crashes with no error message:
class Animated_Model : Game.Animatable// Game Animatable Object
{
SkelAnim *skel_anim=null;
Game.ObjParamsPtr model;
Game.ObjParamsPtr idle_animation;
virtual void create(Game.ObjParams &obj) // extend default creation
{
super.create(obj); // default create
if(Param *par=obj.findParam("mesh" ))model.id() =par.asID();
if(Param *par=obj.findParam("idle" ))idle_animation.id()=par.asID();
if(!model->mesh())Exit("Object has no mesh");
cskel.create(model->mesh()->skeleton(), 1.0);
skel_anim=cskel.findSkelAnim(idle_animation.id());
}
virtual bool update()
{
cskel.clear(); // clear controlled skeleton animation
cskel.animate(skel_anim, Time.time()); // animate with "walk" animation and current time position
cskel.updateMatrix (MatrixIdentity); // update controlled skeleton animation matrixes
cskel.updateVelocities( ); // update controlled skeleton bone velocities (this is needed for Motion Blur effect)
return true;
}
}