Fix camera issues with worlds that have their general height below 0

This commit is contained in:
Lukas Rieger (Blue) 2023-03-27 14:52:11 +02:00
parent be705dad58
commit 3853055cf8
No known key found for this signature in database
GPG Key ID: 2D09EC5ED2687FF2
2 changed files with 3 additions and 2 deletions

View File

@ -145,7 +145,7 @@ export class MapControls {
* @param map {Map}
*/
update(delta, map) {
this.manager.position.y = 0; // reset target y position
this.manager.position.y = -10000; // reset target y position
// move
MapControls._beforeMoveTemp.copy(this.manager.position);

View File

@ -24,6 +24,7 @@
*/
import {MathUtils, Vector2} from "three";
import {distance} from "three/addons/nodes/shadernode/ShaderNodeBaseElements";
export class MapHeightControls {
@ -93,7 +94,7 @@ export class MapHeightControls {
}
// adjust targetHeight by distance
this.distanceTagretHeight = Math.max(MathUtils.lerp(this.targetHeight, 0, this.manager.distance / 500), 0);
this.distanceTagretHeight = MathUtils.lerp(this.targetHeight, 0, Math.min(this.manager.distance / 500, 1));
}
getSuggestedHeight() {