changed pose orientation calculation

This commit is contained in:
devZoGok
2021-10-19 19:06:41 +03:00
parent d430bc6fc0
commit 756c58fc89
7 changed files with 45 additions and 28 deletions
+9 -1
View File
@@ -61,7 +61,15 @@ namespace vb01{
void Bone::setPoseRot(Quaternion r){
this->poseRot = r;
setOrientation(restRot);
Quaternion parentSpacePoseRot = parent->globalToLocalOrientation(localToGlobalOrientation(r));
Quaternion parentSpacePoseRot = Quaternion::QUAT_W;
vector<Node*> ancestors = getAncestors(this);
for(int i = 0; i < ancestors.size(); i++)
parentSpacePoseRot = parentSpacePoseRot * ancestors[i]->getOrientation();
for(int i = ancestors.size() - 1; i > 0; i--)
parentSpacePoseRot = parentSpacePoseRot * ancestors[i]->getOrientation().conj();
parentSpacePoseRot = r * parentSpacePoseRot;
setOrientation(parentSpacePoseRot);
}