Skip to content

Commit 87f763c

Browse files
committed
fix(app): fix mixamo vrma
1 parent 2983441 commit 87f763c

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed
-147 KB
Binary file not shown.
8 Bytes
Binary file not shown.

app/src/components/vrm/hikari-mixamo-vrma.tsx

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useAnimations } from '@react-three/drei'
33
import { useFrame } from '@react-three/fiber'
44
import { useEffect } from 'react'
55

6-
import idleUrl from '~/assets/motions/converted/idle.vrma?url'
76
import walkUrl from '~/assets/motions/converted/walk.vrma?url'
87

98
const vrmUrl = import.meta.env.DEV
@@ -15,33 +14,17 @@ useVRM.preload(vrmUrl)
1514

1615
export const HikariMixamoVrma = () => {
1716
const vrm = useVRM(vrmUrl)
18-
const idle = useVRMAnimation(idleUrl, vrm, 'idle')
1917
const walk = useVRMAnimation(walkUrl, vrm, 'walk')
2018

21-
const { actions, names } = useAnimations([idle, walk], vrm.scene)
19+
const { actions } = useAnimations([walk], vrm.scene)
2220

2321
useEffect(() => {
24-
let index: 0 | 1 = 0
25-
26-
// eslint-disable-next-line @masknet/no-timer
27-
const loop = setInterval(() => {
28-
Object.values(actions)[index]?.stop()
29-
console.warn('Stopped:', names[index])
30-
31-
if (index === 1)
32-
index = 0
33-
else
34-
index = 1
35-
36-
Object.values(actions)[index]?.reset().play()
37-
console.warn('Playing:', names[index])
38-
}, 5000)
22+
actions.walk?.reset().play()
3923

4024
return () => {
41-
// eslint-disable-next-line @masknet/no-timer
42-
clearInterval(loop)
25+
actions.walk?.stop()
4326
}
44-
}, [actions, names])
27+
}, [actions])
4528

4629
useFrame((_, delta) => vrm.update(delta))
4730

0 commit comments

Comments
 (0)