@inweb/viewer-three 26.9.5 → 26.9.6

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.
@@ -34182,7 +34182,7 @@ void main() {
34182
34182
  }
34183
34183
 
34184
34184
  class WalkControls extends Controls {
34185
- constructor(camera, canvas, groundObjects, viewer) {
34185
+ constructor(camera, canvas, groundObjects) {
34186
34186
  super(camera, canvas);
34187
34187
  this.EYE_HEIGHT = 1.7;
34188
34188
  this.FAILING_DISTANCE = 2;
@@ -34258,11 +34258,7 @@ void main() {
34258
34258
  if (this.moveKeys.delete(event.code))
34259
34259
  this.update();
34260
34260
  };
34261
- this.initHighlighter = () => {
34262
- this.highlighter = this.viewer.getComponent("HighlighterComponent");
34263
- };
34264
34261
  this.camera = camera;
34265
- this.viewer = viewer;
34266
34262
  this.groundObjects = groundObjects;
34267
34263
  this.raycaster = new Raycaster();
34268
34264
  this.raycaster.near = 0;
@@ -34291,7 +34287,8 @@ void main() {
34291
34287
  super.dispose();
34292
34288
  }
34293
34289
  updateGroundFollowing() {
34294
- this.raycaster.set(this.object.position, new Vector3(0, -1, 0));
34290
+ const up = new Vector3().copy(this.camera.up);
34291
+ this.raycaster.set(this.object.position, up.negate());
34295
34292
  this.raycaster.params = this.raycaster.params = {
34296
34293
  Mesh: {},
34297
34294
  Line: { threshold: 0 },
@@ -34307,20 +34304,6 @@ void main() {
34307
34304
  this.object.position.y = MathUtils.lerp(this.object.position.y, targetY, this.GROUND_FOLLOWING_SPEED);
34308
34305
  }
34309
34306
  }
34310
- select(objects, model) {
34311
- if (!model) {
34312
- this.viewer.models.forEach((model) => this.select(objects, model));
34313
- return;
34314
- }
34315
- if (!Array.isArray(objects))
34316
- objects = [objects];
34317
- if (!objects.length)
34318
- return;
34319
- model.showOriginalObjects(objects);
34320
- this.highlighter.highlight(objects);
34321
- objects.forEach((object) => this.viewer.selected.push(object));
34322
- objects.forEach((object) => (object.isSelected = true));
34323
- }
34324
34307
  update() {
34325
34308
  let moved = false;
34326
34309
  let upgradeGroundFollowing = false;
@@ -34420,14 +34403,12 @@ void main() {
34420
34403
  this.controls.rotateDelta.set(0, 0);
34421
34404
  };
34422
34405
  const meshOnlyGround = [];
34423
- viewer.models[0].getObjects().forEach((obj) => {
34424
- obj.traverse((child) => {
34425
- if (child instanceof Mesh) {
34426
- meshOnlyGround.push(child);
34427
- }
34428
- });
34429
- });
34430
- this.controls = new WalkControls(viewer.camera, viewer.canvas, meshOnlyGround, viewer);
34406
+ viewer.models.forEach((model) => model.getVisibleObjects().forEach((obj) => {
34407
+ if (obj instanceof Mesh) {
34408
+ meshOnlyGround.push(obj);
34409
+ }
34410
+ }));
34411
+ this.controls = new WalkControls(viewer.camera, viewer.canvas, meshOnlyGround);
34431
34412
  this.controls.addEventListener("change", this.controlsChange);
34432
34413
  this.controls.addEventListener("walkspeedchange", this.walkspeedChange);
34433
34414
  this.viewer = viewer;