diff --git a/editor/mainglwidget.cpp b/editor/mainglwidget.cpp index 4336cdc..de4ea19 100644 --- a/editor/mainglwidget.cpp +++ b/editor/mainglwidget.cpp @@ -259,16 +259,8 @@ void MainGLWidget::handleRotationalTransform(QMouseEvent* evt) { glm::vec2 initVec = glm::normalize(startPoint - (glm::vec2)screenPos); glm::vec2 destVec = glm::normalize(destPoint - (glm::vec2)screenPos); float angle = atan2f(initVec.x * destVec.y - initVec.y * destVec.x, initVec.x * destVec.x + initVec.y * destVec.y); - - float sign = glm::sign(initVec.x) * glm::sign(destVec.x); - // printf(": %f\n", part->cframe.ToEulerAnglesXYZ().Y()); - // printVec(part->cframe.ToEulerAnglesXYZ()); - - Data::Vector3 angles = part->cframe.ToEulerAnglesXYZ(); - // Make angles positive, for convenience - // angles = glm::mod(glm::vec3(angles + glm::vec3(0, 0.01, 0) + glm::vec3(2*glm::pi())), glm::pi()); - angles = angles + glm::sign(angles.X()) * glm::vec3(0, angle, 0); - part->cframe = Data::CFrame::FromEulerAnglesXYZ(angles) + part->cframe.Position(); + + part->cframe = part->cframe * Data::CFrame::FromEulerAnglesXYZ(glm::vec3(0, -angle, 0)); syncPartPhysics(std::dynamic_pointer_cast(editorToolHandles->adornee->lock())); }