Skip to content

Commit

Permalink
Merge pull request #1670 from xeokit/XEOK-114-fix-aabb-after-rotating…
Browse files Browse the repository at this point in the history
…-model

XEOK-114 Fix wrong aabb value after rotating a model
  • Loading branch information
xeolabs authored Sep 13, 2024
2 parents e9697ba + 824c473 commit 80e63fd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/viewer/scene/model/SceneModelMesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,15 @@ export class SceneModelMesh {
*/
set aabb(aabb) { // Called by SceneModel
this._aabbLocal = aabb;
if (this.origin) {
const origin = this.origin;
this._aabbLocal[0] += origin[0];
this._aabbLocal[1] += origin[1];
this._aabbLocal[2] += origin[2];
this._aabbLocal[3] += origin[0];
this._aabbLocal[4] += origin[1];
this._aabbLocal[5] += origin[2];
}
}

/**
Expand All @@ -391,15 +400,6 @@ export class SceneModelMesh {
math.transformOBB3(this.model.worldMatrix, tempOBB3, tempOBB3b);
math.OBB3ToAABB3(tempOBB3b, this._aabbWorld);
}
if (this.origin) {
const origin = this.origin;
this._aabbWorld[0] += origin[0];
this._aabbWorld[1] += origin[1];
this._aabbWorld[2] += origin[2];
this._aabbWorld[3] += origin[0];
this._aabbWorld[4] += origin[1];
this._aabbWorld[5] += origin[2];
}
this._aabbWorldDirty = false;
}
return this._aabbWorld;
Expand Down

0 comments on commit 80e63fd

Please sign in to comment.