mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-02 02:40:52 +02:00
fix create in negative space bug
This commit is contained in:
parent
5a442bdb30
commit
010a3d8220
1 changed files with 4 additions and 3 deletions
|
@ -1036,6 +1036,7 @@ function handeMenuEvent(menuItem) {
|
||||||
// This function tries to find a reasonable position to place a new entity based on the camera
|
// This function tries to find a reasonable position to place a new entity based on the camera
|
||||||
// position. If a reasonable position within the world bounds can't be found, `null` will
|
// position. If a reasonable position within the world bounds can't be found, `null` will
|
||||||
// be returned. The returned position will also take into account grid snapping settings.
|
// be returned. The returned position will also take into account grid snapping settings.
|
||||||
|
// FIXME - technically we should guard against very large positions too
|
||||||
function getPositionToCreateEntity() {
|
function getPositionToCreateEntity() {
|
||||||
var distance = cameraManager.enabled ? cameraManager.zoomDistance : DEFAULT_ENTITY_DRAG_DROP_DISTANCE;
|
var distance = cameraManager.enabled ? cameraManager.zoomDistance : DEFAULT_ENTITY_DRAG_DROP_DISTANCE;
|
||||||
var direction = Quat.getFront(Camera.orientation);
|
var direction = Quat.getFront(Camera.orientation);
|
||||||
|
@ -1055,9 +1056,9 @@ function getPositionToCreateEntity() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
placementPosition.x = Math.max(0, placementPosition.x);
|
placementPosition.x = Math.max(-HALF_TREE_SCALE, placementPosition.x);
|
||||||
placementPosition.y = Math.max(0, placementPosition.y);
|
placementPosition.y = Math.max(-HALF_TREE_SCALE, placementPosition.y);
|
||||||
placementPosition.z = Math.max(0, placementPosition.z);
|
placementPosition.z = Math.max(-HALF_TREE_SCALE, placementPosition.z);
|
||||||
|
|
||||||
return placementPosition;
|
return placementPosition;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue