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