add vrm mode
This commit is contained in:
@@ -9,7 +9,6 @@ import * as THREE from 'three';
|
||||
import { keys, adminMode } from './controls/KeyInput';
|
||||
|
||||
const BASE_URL = import.meta.env.BASE_URL;
|
||||
const VRM_URL = `${BASE_URL}model/ai.vrm`;
|
||||
|
||||
export const VRMA_FILES = [
|
||||
{ name: 'idle', label: '待機', file: 'idle.vrma', loop: true },
|
||||
@@ -54,14 +53,15 @@ function trimClip(clip, duration, addLoopPose) {
|
||||
return clip;
|
||||
}
|
||||
|
||||
export default function VrmCharacter({ selectedAnimation: animState }) {
|
||||
export default function VrmCharacter({ selectedAnimation: animState, vrmModel = 'ai.vrm' }) {
|
||||
const selectedAnimation = animState?.name || animState;
|
||||
const mixerRef = useRef(null);
|
||||
const vrmRef = useRef(null);
|
||||
const actionsRef = useRef({});
|
||||
const currentActionRef = useRef(null);
|
||||
|
||||
const gltf = useLoader(GLTFLoader, VRM_URL, (loader) => {
|
||||
const vrmUrl = `${BASE_URL}model/${vrmModel}`;
|
||||
const gltf = useLoader(GLTFLoader, vrmUrl, (loader) => {
|
||||
loader.register((parser) => new VRMLoaderPlugin(parser));
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user