Files
vb01/skeleton.cpp
T
devZoGok 4f4bc88956 attached objects follow their bones
model space positions are retrieved from bones
supported more than 4 bones
improved global and local orientation methods
improved vector angle method
2021-10-19 19:06:41 +03:00

38 lines
633 B
C++

#include"skeleton.h"
#include"animation.h"
#include"box.h"
using namespace std;
namespace vb01{
Skeleton::Skeleton(string name){
this->name=name;
}
void Skeleton::addBone(Bone *bone, Bone *parent){
parent->attachChild(bone);
bone->setSkeleton(this);
bones.push_back(bone);
}
Bone* Skeleton::getBone(string name){
Bone *bone=nullptr;
for(Bone *b : bones)
if(b->getName()==name){
bone=b;
break;
}
return bone;
}
Animation* Skeleton::getAnimation(string name){
Animation *anim=nullptr;
for(Animation *a : animations)
if(a->getName()==name){
anim=a;
break;
}
return anim;
}
}