void RDragger::drag() { projector.setViewVolume(this->getViewVolume()); projector.setWorkingSpace(this->getLocalToWorldMatrix()); SbVec3f hitPoint; if (!projector.tryProject(getNormalizedLocaterPosition(), 0.0, hitPoint)) return; hitPoint.normalize(); SbVec3f startingPoint = getLocalStartingPoint(); startingPoint.normalize(); SbRotation localRotation(startingPoint, hitPoint); //getting some slop from this. grab vector and put it absolute. SbVec3f tempVec; float tempRadians; localRotation.getValue(tempVec, tempRadians); tempVec[0] = 0.0; tempVec[1] = 0.0; tempVec.normalize(); if (tempVec[2] < 0.0) { tempRadians *= -1.0; tempVec.negate(); } int incrementCount = roundIncrement(tempRadians); rotationIncrementCount.setValue(incrementCount); localRotation = SbRotation(tempVec, incrementCount * static_cast<float>(rotationIncrement.getValue())); //same problem as described in tDragger::drag. if (localRotation.equals(SbRotation(SbVec3f(0.0, 0.0, 1.0), 0.0), 0.00001f)) { setMotionMatrix(getStartMotionMatrix()); this->valueChanged(); } else setMotionMatrix(appendRotation(getStartMotionMatrix(), localRotation, SbVec3f(0.0, 0.0, 0.0))); Base::Quantity quantity( static_cast<double>(rotationIncrementCount.getValue()) * (180.0 / M_PI) * rotationIncrement.getValue(), Base::Unit::Angle); QString message(QObject::tr("Rotation: ")); message += quantity.getUserString(); getMainWindow()->showMessage(message, 3000); }