mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 12:23:24 +02:00
Fix oscillating positions as translate when snapping to grid
This commit is contained in:
parent
9709599c1a
commit
a642324a11
1 changed files with 3 additions and 1 deletions
|
@ -1763,6 +1763,7 @@ SelectionDisplay = (function() {
|
|||
function addHandleTranslateTool(overlay, mode, direction) {
|
||||
var pickNormal = null;
|
||||
var lastPick = null;
|
||||
var initialPosition = null;
|
||||
var projectionVector = null;
|
||||
var previousPickRay = null;
|
||||
addHandleTool(overlay, {
|
||||
|
@ -1782,6 +1783,7 @@ SelectionDisplay = (function() {
|
|||
pickNormal = Vec3.cross(Vec3.cross(pickRay.direction, axisVector), axisVector);
|
||||
|
||||
lastPick = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, pickNormal);
|
||||
initialPosition = SelectionManager.worldPosition;
|
||||
|
||||
SelectionManager.saveProperties();
|
||||
that.resetPreviousHandleColor();
|
||||
|
@ -1816,7 +1818,7 @@ SelectionDisplay = (function() {
|
|||
pickRay = previousPickRay;
|
||||
}
|
||||
|
||||
var newIntersection = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, pickNormal);
|
||||
var newIntersection = rayPlaneIntersection(pickRay, initialPosition, pickNormal);
|
||||
var vector = Vec3.subtract(newIntersection, lastPick);
|
||||
|
||||
if (direction === TRANSLATE_DIRECTION.X) {
|
||||
|
|
Loading…
Reference in a new issue