mirror of
https://github.com/overte-org/overte.git
synced 2025-08-05 11:19:51 +02:00
Update UpDown translation to follow the mouse as other tools do
This commit is contained in:
parent
c4ca7e1b18
commit
aa067bc153
1 changed files with 10 additions and 5 deletions
|
@ -1297,10 +1297,17 @@ SelectionDisplay = (function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
var lastXYPick = null
|
var lastXYPick = null
|
||||||
|
var upDownPickNormal = null;
|
||||||
addGrabberTool(grabberMoveUp, {
|
addGrabberTool(grabberMoveUp, {
|
||||||
mode: "TRANSLATE_UP_DOWN",
|
mode: "TRANSLATE_UP_DOWN",
|
||||||
onBegin: function(event) {
|
onBegin: function(event) {
|
||||||
lastXYPick = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, Quat.getFront(lastCameraOrientation));
|
pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
|
|
||||||
|
upDownPickNormal = Quat.getFront(lastCameraOrientation);
|
||||||
|
// Remove y component so the y-axis lies along the plane we picking on - this will
|
||||||
|
// give movements that follow the mouse.
|
||||||
|
upDownPickNormal.y = 0;
|
||||||
|
lastXYPick = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, upDownPickNormal);
|
||||||
|
|
||||||
SelectionManager.saveProperties();
|
SelectionManager.saveProperties();
|
||||||
|
|
||||||
|
@ -1328,11 +1335,9 @@ SelectionDisplay = (function () {
|
||||||
pickRay = Camera.computePickRay(event.x, event.y);
|
pickRay = Camera.computePickRay(event.x, event.y);
|
||||||
|
|
||||||
// translate mode left/right based on view toward entity
|
// translate mode left/right based on view toward entity
|
||||||
var newIntersection = rayPlaneIntersection(pickRay,
|
var newIntersection = rayPlaneIntersection(pickRay, SelectionManager.worldPosition, upDownPickNormal);
|
||||||
SelectionManager.worldPosition,
|
|
||||||
Quat.getFront(lastCameraOrientation));
|
|
||||||
|
|
||||||
var vector = Vec3.subtract(newIntersection, lastPlaneIntersection);
|
var vector = Vec3.subtract(newIntersection, lastXYPick);
|
||||||
vector = grid.snapToGrid(vector);
|
vector = grid.snapToGrid(vector);
|
||||||
|
|
||||||
// we only care about the Y axis
|
// we only care about the Y axis
|
||||||
|
|
Loading…
Reference in a new issue