1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-06-05 16:24:10 +02:00
This commit is contained in:
syuilo
2026-02-20 16:43:12 +09:00
parent bba7076eca
commit d68655f5c2
6 changed files with 24 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@@ -3,18 +3,39 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js'; import { defineObject } from '../engine.js';
export const bed = defineObject({ export const bed = defineObject({
id: 'bed', id: 'bed',
name: 'Bed', name: 'Bed',
options: { options: {
schema: {}, schema: {
default: {}, color: {
type: 'color',
label: 'Color',
},
},
default: {
color: [0.2, 0.1, 0.02],
},
}, },
placement: 'floor', placement: 'floor',
createInstance: () => { createInstance: ({ options, root }) => {
const bodyMesh = root.getChildMeshes().find(m => m.name.includes('__X_BODY__')) as BABYLON.Mesh;
const bodyMaterial = bodyMesh.material as BABYLON.PBRMaterial;
const applyColor = () => {
const [r, g, b] = options.color;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyColor();
return { return {
onOptionsUpdated: ([k, v]) => {
applyColor();
},
interactions: {}, interactions: {},
}; };
}, },