@inweb/viewer-three 27.1.9 → 27.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/viewer-three.js +22 -14
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +1 -1
- package/dist/viewer-three.module.js +22 -14
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/Viewer.d.ts +1 -1
- package/lib/Viewer/controls/WalkControls.d.ts +6 -1
- package/package.json +5 -5
- package/src/Viewer/Viewer.ts +1 -1
- package/src/Viewer/controls/WalkControls.ts +24 -15
package/dist/viewer-three.js
CHANGED
|
@@ -35108,14 +35108,19 @@ void main() {
|
|
|
35108
35108
|
super(camera, canvas);
|
|
35109
35109
|
this.EYE_HEIGHT = 1.7;
|
|
35110
35110
|
this.FAILING_DISTANCE = 2;
|
|
35111
|
-
this.
|
|
35111
|
+
this.GROUND_FOLLOWING_SKIP_FRAMES = 3;
|
|
35112
|
+
this.GROUND_FOLLOWING_SPEED = 0.4;
|
|
35112
35113
|
this.LOOK_SPEED = 0.1;
|
|
35113
35114
|
this.WALK_SPEED_DELIMITER = 4;
|
|
35114
35115
|
this.WHEEL_SPEED_DELIMITER = 15000;
|
|
35115
35116
|
this.movementSpeed = 0.1;
|
|
35116
35117
|
this.multiplier = 3;
|
|
35118
|
+
this.groundFollowingSkippedFrames = 0;
|
|
35117
35119
|
this.moveWheel = 0;
|
|
35118
35120
|
this.mouseDragOn = false;
|
|
35121
|
+
this._up = new Vector3();
|
|
35122
|
+
this._forward = new Vector3();
|
|
35123
|
+
this._sideways = new Vector3();
|
|
35119
35124
|
this.onPointerDown = (event) => {
|
|
35120
35125
|
if (event.button !== 0)
|
|
35121
35126
|
return;
|
|
@@ -35185,6 +35190,14 @@ void main() {
|
|
|
35185
35190
|
this.raycaster = new Raycaster();
|
|
35186
35191
|
this.raycaster.near = 0;
|
|
35187
35192
|
this.raycaster.far = this.EYE_HEIGHT + this.FAILING_DISTANCE;
|
|
35193
|
+
this.raycaster.params = {
|
|
35194
|
+
Mesh: {},
|
|
35195
|
+
Line: { threshold: 0 },
|
|
35196
|
+
Line2: { threshold: 0 },
|
|
35197
|
+
LOD: { threshold: 0 },
|
|
35198
|
+
Points: { threshold: 0 },
|
|
35199
|
+
Sprite: { threshold: 0 },
|
|
35200
|
+
};
|
|
35188
35201
|
this.moveKeys = new Set();
|
|
35189
35202
|
this.moveClock = new Clock();
|
|
35190
35203
|
this.quaternion = camera.quaternion.clone();
|
|
@@ -35209,16 +35222,8 @@ void main() {
|
|
|
35209
35222
|
super.dispose();
|
|
35210
35223
|
}
|
|
35211
35224
|
updateGroundFollowing() {
|
|
35212
|
-
|
|
35213
|
-
this.raycaster.set(this.object.position,
|
|
35214
|
-
this.raycaster.params = this.raycaster.params = {
|
|
35215
|
-
Mesh: {},
|
|
35216
|
-
Line: { threshold: 0 },
|
|
35217
|
-
Line2: { threshold: 0 },
|
|
35218
|
-
LOD: { threshold: 0 },
|
|
35219
|
-
Points: { threshold: 0 },
|
|
35220
|
-
Sprite: { threshold: 0 },
|
|
35221
|
-
};
|
|
35225
|
+
this._up.copy(this.camera.up).negate();
|
|
35226
|
+
this.raycaster.set(this.object.position, this._up);
|
|
35222
35227
|
const intersects = this.raycaster.intersectObjects(this.groundObjects, false);
|
|
35223
35228
|
if (intersects.length > 0) {
|
|
35224
35229
|
const groundY = intersects[0].point.y;
|
|
@@ -35229,8 +35234,8 @@ void main() {
|
|
|
35229
35234
|
update() {
|
|
35230
35235
|
let moved = false;
|
|
35231
35236
|
let upgradeGroundFollowing = false;
|
|
35232
|
-
const forward =
|
|
35233
|
-
const sideways =
|
|
35237
|
+
const forward = this._forward;
|
|
35238
|
+
const sideways = this._sideways;
|
|
35234
35239
|
if (this.moveKeys.size > 0) {
|
|
35235
35240
|
upgradeGroundFollowing = true;
|
|
35236
35241
|
const timeDelta = this.moveClock.getDelta();
|
|
@@ -35282,8 +35287,11 @@ void main() {
|
|
|
35282
35287
|
this.moveWheel += -1 * Math.sign(this.moveWheel);
|
|
35283
35288
|
moved = true;
|
|
35284
35289
|
}
|
|
35285
|
-
|
|
35290
|
+
this.groundFollowingSkippedFrames++;
|
|
35291
|
+
if (upgradeGroundFollowing && this.groundFollowingSkippedFrames >= this.GROUND_FOLLOWING_SKIP_FRAMES) {
|
|
35292
|
+
this.groundFollowingSkippedFrames = 0;
|
|
35286
35293
|
this.updateGroundFollowing();
|
|
35294
|
+
}
|
|
35287
35295
|
if (moved) {
|
|
35288
35296
|
this.dispatchEvent({ type: "change" });
|
|
35289
35297
|
}
|