Skip to content

Commit 3853055

Browse files
committed
Fix camera issues with worlds that have their general height below 0
1 parent be705da commit 3853055

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

BlueMapCommon/webapp/src/js/controls/map/MapControls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class MapControls {
145145
* @param map {Map}
146146
*/
147147
update(delta, map) {
148-
this.manager.position.y = 0; // reset target y position
148+
this.manager.position.y = -10000; // reset target y position
149149

150150
// move
151151
MapControls._beforeMoveTemp.copy(this.manager.position);

BlueMapCommon/webapp/src/js/controls/map/MapHeightControls.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*/
2525

2626
import {MathUtils, Vector2} from "three";
27+
import {distance} from "three/addons/nodes/shadernode/ShaderNodeBaseElements";
2728

2829
export class MapHeightControls {
2930

@@ -93,7 +94,7 @@ export class MapHeightControls {
9394
}
9495

9596
// adjust targetHeight by distance
96-
this.distanceTagretHeight = Math.max(MathUtils.lerp(this.targetHeight, 0, this.manager.distance / 500), 0);
97+
this.distanceTagretHeight = MathUtils.lerp(this.targetHeight, 0, Math.min(this.manager.distance / 500, 1));
9798
}
9899

99100
getSuggestedHeight() {

0 commit comments

Comments
 (0)