Skip to content

Commit 1737745

Browse files
Center camera on all axis on focus (#1137)
2 parents ff0ad7d + 1077afb commit 1737745

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

fission/src/mirabuf/MirabufSceneObject.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,9 @@ class MirabufSceneObject extends SceneObject implements ContextSupplier {
541541
}
542542

543543
public LoadFocusTransform(mat: THREE.Matrix4) {
544-
const com = World.PhysicsSystem.GetBody(
545-
this._mechanism.nodeToBody.get(this.rootNodeId)!
546-
).GetCenterOfMassTransform()
547-
mat.copy(JoltMat44_ThreeMatrix4(com))
544+
const bounds = this.ComputeBoundingBox()
545+
const center = bounds.getCenter(new THREE.Vector3())
546+
mat.makeTranslation(center.x, center.y, center.z)
548547
}
549548

550549
public getSupplierData(): ContextData {

0 commit comments

Comments
 (0)