mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-13 18:45:35 +02:00
fix
This commit is contained in:
@@ -199,7 +199,6 @@ export class RoomController {
|
||||
}
|
||||
|
||||
public addObject(type: string) {
|
||||
console.log(type);
|
||||
if (this.worker != null) {
|
||||
this.worker.postMessage({ type: 'addObject', objectType: type });
|
||||
} else if (this.engine != null) {
|
||||
|
||||
@@ -21,6 +21,8 @@ export const ceilingFanLight = defineObject({
|
||||
const rotor = model.findMesh('Rotor');
|
||||
model.bakeExcludeMeshes = [rotor, ...rotor.getChildMeshes()];
|
||||
|
||||
let animationObserver: BABYLON.Observer<BABYLON.Scene>;
|
||||
|
||||
return {
|
||||
onInited: () => {
|
||||
rotor.rotation = rotor.rotationQuaternion != null ? rotor.rotationQuaternion.toEulerAngles() : rotor.rotation;
|
||||
@@ -30,12 +32,17 @@ export const ceilingFanLight = defineObject({
|
||||
{ frame: 100, value: Math.PI * 2 },
|
||||
]);
|
||||
rotor.animations = [anim];
|
||||
scene.onAfterAnimationsObservable.add(() => {
|
||||
animationObserver = scene.onAfterAnimationsObservable.add(() => {
|
||||
room?.sr.updateMesh([rotor, ...rotor.getChildMeshes()]);
|
||||
});
|
||||
scene.beginAnimation(rotor, 0, 100, true);
|
||||
},
|
||||
interactions: {},
|
||||
dispose: () => {
|
||||
if (animationObserver != null) {
|
||||
scene.onAfterAnimationsObservable.remove(animationObserver);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
@@ -15,10 +15,12 @@ export const radiometer = defineObject({
|
||||
},
|
||||
placement: 'top',
|
||||
hasCollisions: false,
|
||||
createInstance: ({ scene, model }) => {
|
||||
createInstance: ({ room, scene, model }) => {
|
||||
const vanes = model.findTransformNode('__X_VANES__');
|
||||
model.bakeExcludeMeshes = [...vanes.getChildMeshes()];
|
||||
|
||||
let animationObserver: BABYLON.Observer<BABYLON.Scene>;
|
||||
|
||||
return {
|
||||
onInited: () => {
|
||||
vanes.rotation = vanes.rotationQuaternion != null ? vanes.rotationQuaternion.toEulerAngles() : vanes.rotation;
|
||||
@@ -28,9 +30,17 @@ export const radiometer = defineObject({
|
||||
{ frame: 240, value: Math.PI * 2 },
|
||||
]);
|
||||
vanes.animations = [anim];
|
||||
animationObserver = scene.onAfterAnimationsObservable.add(() => {
|
||||
room?.sr.updateMesh([...vanes.getChildMeshes()]);
|
||||
});
|
||||
scene.beginAnimation(vanes, 0, 240, true);
|
||||
},
|
||||
interactions: {},
|
||||
dispose: () => {
|
||||
if (animationObserver != null) {
|
||||
scene.onAfterAnimationsObservable.remove(animationObserver);
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user