Skip to content

Commit

Permalink
Fixing LookAt method on ofNode (#6069)
Browse files Browse the repository at this point in the history
  • Loading branch information
patriciogonzalezvivo authored and arturoc committed Jul 31, 2018
1 parent 6e465e1 commit 62949ae
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions libs/openFrameworks/3d/ofNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,9 @@ void ofNode::lookAt(const glm::vec3& lookAtPosition){
if(radius>0){
float latitude = acos(relPosition.y / radius) - glm::half_pi<float>();
float longitude = atan2(relPosition.x , relPosition.z);
glm::quat q = glm::angleAxis(latitude, glm::vec3(1,0,0)) * glm::angleAxis(longitude, glm::vec3(0,1,0)) * glm::angleAxis(0.f, glm::vec3(0,0,1));
glm::quat q = glm::angleAxis(0.f, glm::vec3(0,0,1)) * glm::angleAxis(longitude, glm::vec3(0,1,0)) * glm::angleAxis(latitude, glm::vec3(1,0,0));
setGlobalOrientation(q);
}

}

//----------------------------------------
Expand Down Expand Up @@ -676,7 +675,7 @@ void ofNode::createMatrix() {
localTransformMatrix = glm::translate(glm::mat4(1.0), toGlm(position));
localTransformMatrix = localTransformMatrix * glm::toMat4((const glm::quat&)orientation);
localTransformMatrix = glm::scale(localTransformMatrix, toGlm(scale));

updateAxis();
}

Expand Down

0 comments on commit 62949ae

Please sign in to comment.