Skip to content

Commit 16cc78e

Browse files
author
tpat
committed
Fixed view needing to be aligned with z-axis for rotation
1 parent 670b995 commit 16cc78e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Interface/Modules/Render/ES/SRInterface.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,9 +665,9 @@ namespace SCIRun {
665665
mWidgetTransform.setPosition(newPos);
666666

667667
// Rotate
668-
glm::vec3 viewVec = (cam->data.projIV * glm::vec4(0.0, 0.0, -1.0, 0.0)).xyz();
669-
glm::vec3 rotAxis = glm::cross(glm::normalize(viewVec), transVec);
670-
glm::mat4 rot = glm::rotate(glm::length(transVec), rotAxis);
668+
glm::vec3 viewVec = (cam->data.getView() * glm::vec4(0.0, 0.0, 1.0, 0.0)).xyz();
669+
glm::vec3 rotAxis = glm::cross(glm::normalize(viewVec), glm::normalize(transProjVec));
670+
glm::mat4 rot = glm::rotate(glm::length(transProjVec), rotAxis);
671671
mWidgetTransform.transform = rot * mWidgetTransform.transform;
672672

673673
// Translate back to world space

0 commit comments

Comments
 (0)