mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-13 14:05:35 +02:00
newtonsCradle
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -49,6 +49,7 @@ import { monitor } from './objects/monitor.js';
|
||||
import { monitorSpeaker } from './objects/monitorSpeaker.js';
|
||||
import { monstera } from './objects/monstera.js';
|
||||
import { mug } from './objects/mug.js';
|
||||
import { newtonsCradle } from './objects/newtonsCradle.js';
|
||||
import { openedCardboardBox } from './objects/openedCardboardBox.js';
|
||||
import { pachira } from './objects/pachira.js';
|
||||
import { pc } from './objects/pc.js';
|
||||
@@ -138,6 +139,7 @@ export const OBJECT_DEFS = [
|
||||
monitorSpeaker,
|
||||
monstera,
|
||||
mug,
|
||||
newtonsCradle,
|
||||
openedCardboardBox,
|
||||
pachira,
|
||||
pc,
|
||||
|
||||
43
packages/frontend/src/utility/room/objects/newtonsCradle.ts
Normal file
43
packages/frontend/src/utility/room/objects/newtonsCradle.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 newtonsCradle = defineObject({
|
||||
id: 'newtonsCradle',
|
||||
name: 'newtonsCradle',
|
||||
options: {
|
||||
schema: {
|
||||
frameColor: {
|
||||
type: 'color',
|
||||
label: 'Frame color',
|
||||
},
|
||||
},
|
||||
default: {
|
||||
frameColor: [0.15, 0.15, 0.15],
|
||||
},
|
||||
},
|
||||
placement: 'top',
|
||||
createInstance: ({ options, model }) => {
|
||||
const frameMaterial = model.findMaterial('__X_FRAME__');
|
||||
|
||||
const applyFrameColor = () => {
|
||||
const [r, g, b] = options.frameColor;
|
||||
frameMaterial.albedoColor = new BABYLON.Color3(r, g, b);
|
||||
};
|
||||
|
||||
applyFrameColor();
|
||||
|
||||
return {
|
||||
onOptionsUpdated: ([k, v]) => {
|
||||
switch (k) {
|
||||
case 'frameColor': applyFrameColor(); break;
|
||||
}
|
||||
},
|
||||
interactions: {},
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user