1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-15 20:55:46 +02:00
This commit is contained in:
syuilo
2026-04-09 08:57:31 +09:00
parent 9b3424c5d3
commit 45c851bb5b
4 changed files with 43 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ import { openedCardboardBox } from './objects/openedCardboardBox.js';
import { pachira } from './objects/pachira.js';
import { pc } from './objects/pc.js';
import { petBottle } from './objects/petBottle.js';
import { piano } from './objects/piano.js';
import { pictureFrame } from './objects/pictureFrame.js';
import { plant } from './objects/plant.js';
import { plant2 } from './objects/plant2.js';
@@ -114,6 +115,7 @@ export const OBJECT_DEFS = [
pachira,
pc,
petBottle,
piano,
pictureFrame,
plant,
plant2,

View File

@@ -0,0 +1,41 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const piano = defineObject({
id: 'piano',
name: 'Piano',
options: {
schema: {
bodyColor: {
type: 'color',
label: 'bodyColor',
},
},
default: {
bodyColor: [0, 0, 0],
},
},
placement: 'floor',
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: {},
};
},
});