@inweb/viewer-three 27.2.2 → 27.2.4
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 +2 -30
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +1 -1
- package/dist/viewer-three.module.js +3 -31
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/controls/WalkControls.d.ts +0 -8
- package/package.json +5 -5
- package/src/Viewer/controls/WalkControls.ts +3 -41
package/dist/viewer-three.js
CHANGED
|
@@ -35147,12 +35147,6 @@ void main() {
|
|
|
35147
35147
|
this.movementSpeed = 0.1;
|
|
35148
35148
|
this.multiplier = 3;
|
|
35149
35149
|
this.groundFollowingSkippedFrames = 0;
|
|
35150
|
-
this.GROUND_BOX_HALF_SIZE = 20;
|
|
35151
|
-
this.GROUND_BOX_REFRESH_THRESHOLD = 0.3;
|
|
35152
|
-
this._groundObjectBoxes = new Map();
|
|
35153
|
-
this._activeGroundObjects = [];
|
|
35154
|
-
this._groundBox = new Box3();
|
|
35155
|
-
this._groundBoxCenter = new Vector3();
|
|
35156
35150
|
this.moveWheel = 0;
|
|
35157
35151
|
this.mouseDragOn = false;
|
|
35158
35152
|
this._up = new Vector3();
|
|
@@ -35224,9 +35218,6 @@ void main() {
|
|
|
35224
35218
|
};
|
|
35225
35219
|
this.camera = camera;
|
|
35226
35220
|
this.groundObjects = groundObjects;
|
|
35227
|
-
for (const obj of groundObjects) {
|
|
35228
|
-
this._groundObjectBoxes.set(obj, new Box3().setFromObject(obj));
|
|
35229
|
-
}
|
|
35230
35221
|
this.raycaster = new Raycaster();
|
|
35231
35222
|
this.raycaster.near = 0;
|
|
35232
35223
|
this.raycaster.far = this.EYE_HEIGHT + this.FAILING_DISTANCE;
|
|
@@ -35261,29 +35252,10 @@ void main() {
|
|
|
35261
35252
|
window.removeEventListener("keyup", this.onKeyUp);
|
|
35262
35253
|
super.dispose();
|
|
35263
35254
|
}
|
|
35264
|
-
_rebuildGroundBox(center) {
|
|
35265
|
-
const h = this.GROUND_BOX_HALF_SIZE;
|
|
35266
|
-
this._groundBoxCenter.copy(center);
|
|
35267
|
-
this._groundBox.set(new Vector3(center.x - h, center.y - h * 4, center.z - h), new Vector3(center.x + h, center.y + h * 4, center.z + h));
|
|
35268
|
-
this._activeGroundObjects = this.groundObjects.filter((obj) => {
|
|
35269
|
-
const objectBox = this._groundObjectBoxes.get(obj);
|
|
35270
|
-
return objectBox !== undefined && this._groundBox.intersectsBox(objectBox);
|
|
35271
|
-
});
|
|
35272
|
-
}
|
|
35273
|
-
_needsGroundBoxRebuild(pos) {
|
|
35274
|
-
if (this._activeGroundObjects.length === 0 && this.groundObjects.length > 0)
|
|
35275
|
-
return true;
|
|
35276
|
-
const threshold = this.GROUND_BOX_HALF_SIZE * this.GROUND_BOX_REFRESH_THRESHOLD;
|
|
35277
|
-
return (Math.abs(pos.x - this._groundBoxCenter.x) > threshold || Math.abs(pos.z - this._groundBoxCenter.z) > threshold);
|
|
35278
|
-
}
|
|
35279
35255
|
updateGroundFollowing() {
|
|
35280
|
-
const pos = this.object.position;
|
|
35281
|
-
if (this._needsGroundBoxRebuild(pos)) {
|
|
35282
|
-
this._rebuildGroundBox(pos);
|
|
35283
|
-
}
|
|
35284
35256
|
this._up.copy(this.camera.up).negate();
|
|
35285
|
-
this.raycaster.set(
|
|
35286
|
-
const intersects = this.raycaster.intersectObjects(this.
|
|
35257
|
+
this.raycaster.set(this.object.position, this._up);
|
|
35258
|
+
const intersects = this.raycaster.intersectObjects(this.groundObjects, false);
|
|
35287
35259
|
if (intersects.length > 0) {
|
|
35288
35260
|
const groundY = intersects[0].point.y;
|
|
35289
35261
|
const targetY = groundY + this.EYE_HEIGHT;
|