useVRM
A convenience hook that uses useLoader
, GLTFLoader
and VRMLoaderPlugin
.
import { useVRM } from '@n3p6/react-three-vrm'
export const AvatarSampleA = () => {
const vrm = useVRM(url)
return (
<primitive
object={vrm.scene}
position={[0, 0, 0]}
rotation={[0, Math.PI, 0]}
/>
)
}
You can also preload a model:
import { useVRM } from '@n3p6/react-three-vrm'
useVRM.preload(url)