1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-12 08:14:08 +02:00
This commit is contained in:
syuilo
2026-03-26 19:13:45 +09:00
parent 58ec8af8cd
commit 4965429069
5 changed files with 30 additions and 4 deletions

View File

@@ -164,6 +164,7 @@ type ObjectDef<OpSc extends OptionsSchema = OptionsSchema> = {
findMesh: (keyword: string) => BABYLON.Mesh;
findMeshes: (keyword: string) => BABYLON.Mesh[];
findMaterial: (keyword: string) => BABYLON.PBRMaterial;
findTransformNode: (keyword: string) => BABYLON.TransformNode;
}) => RoomObjectInstance<GetOptionsSchemaValues<OpSc>>;
};
@@ -956,6 +957,13 @@ export class RoomEngine {
findMaterial: (keyword) => {
return findMaterial(root, keyword);
},
findTransformNode: (keyword) => {
const node = root.getChildTransformNodes().find(n => n.name.includes(keyword));
if (node == null) {
throw new Error(`TransformNode with keyword "${keyword}" not found for object ${args.type} (${args.id})`);
}
return node;
},
});
this.objectInstances.set(args.id, objectInstance);