fixed quaterinon axis retrieval and cross product functions

This commit is contained in:
devZoGok
2021-10-19 19:06:40 +03:00
parent 169d5755ce
commit 54544b4d96
5 changed files with 30 additions and 20 deletions
+7
View File
@@ -112,6 +112,13 @@ namespace vb01{
text->setNode(this);
}
void Node::lookAt(Vector3 newDir){
Vector3 dir=getLocalAxis(0).norm();
float angle=dir.getAngleBetween(newDir.norm());
Vector3 rotAxis=dir.cross(newDir.norm());
orientation=Quaternion(angle,rotAxis)*orientation;
}
void Node::getDescendants(Node *node, vector<Node*> &descendants){
for(int i=0;i<node->getNumChildren();i++){
if(node->getChild(i)->getNumChildren()>0)