1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-21 18:05:29 +02:00
This commit is contained in:
syuilo
2026-04-20 20:47:31 +09:00
parent 2b456fec47
commit 2040827615
7 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../object.js';
export const sofa = defineObject({
id: 'sofa',
name: 'Sofa',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'bodyColor',
},
},
default: {
bodyColor: [0.4, 0.4, 0.4],
},
},
placement: 'floor',
hasCollisions: true,
canPreMeshesMerging: true,
hasTexture: false,
createInstance: ({ options, model }) => {
const bodyMaterial = model.findMaterial('__X_BODY__');
const applyBodyColor = () => {
const [r, g, b] = options.bodyColor;
bodyMaterial.albedoColor = new BABYLON.Color3(r, g, b);
};
applyBodyColor();
return {
onOptionsUpdated: ([k, v]) => {
applyBodyColor();
},
interactions: {},
};
},
});