I have a scene::IAnimatedMeshSceneNode*. I want to change its animation according to what state it's in
i can call mesh->setFrameLoop() just after it has loaded, but if I call it at render time it gets an "access violation" and crashes
any ideas why?
mesh->setFrameLoop() access violation
I found the problem, it was that mesh was undefined in some cases.
so
so
Code: Select all
if(NULL != mesh){
//what state you are in
if(state != tmpstate){
switch (state){
case 0://idle
mesh->setFrameLoop(myType->idle_start, myType->idle_end);
tmpstate = 0;
break;
case 1://walking
mesh->setFrameLoop(myType->walk_start, myType->walk_end);
tmpstate = 1;
break;
case 2://attacking
mesh->setFrameLoop(myType->attack_start, myType->attack_end);
tmpstate = 2;
break;
case 3://attacking
mesh->setFrameLoop(myType->attack_start, myType->attack_end);
tmpstate = 3;
break;
default:
mesh->setFrameLoop(myType->idle_start, myType->idle_end);
break;
}
}
}