1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-14 19:15:52 +02:00

Update engine.ts

This commit is contained in:
syuilo
2026-04-09 11:16:43 +09:00
parent 45c851bb5b
commit 03c0b48e1e

View File

@@ -708,8 +708,27 @@ export class RoomEngine {
if (oid != null && this.objectEntities.has(oid)) {
const o = this.objectEntities.get(oid)!;
const boundingInfo = getMeshesBoundingBox(o.rootMesh.getChildMeshes().filter(m => m.isEnabled() && m.isVisible));
this.camera.setTarget(boundingInfo.center);
this.selectObject(oid);
{ // camera animation
const animTarget = new BABYLON.Animation(
'',
'target',
60,
BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT,
);
const keys = [
{ frame: 0, value: this.camera.target.clone() },
{ frame: 30, value: boundingInfo.center.clone() },
];
animTarget.setKeys(keys);
const easing = new BABYLON.CubicEase();
easing.setEasingMode(BABYLON.EasingFunction.EASINGMODE_EASEOUT);
animTarget.setEasingFunction(easing);
this.camera.animations.push(animTarget);
this.scene.beginAnimation(this.camera, 0, 30, false);
}
}
}
});