GLb animation Issue With useAnimation Hooks in R3F

Поділитися
Вставка
  • Опубліковано 8 вер 2024

КОМЕНТАРІ • 1

  • @paradise_hope
    @paradise_hope  2 місяці тому

    //mode1.jsx --------> here i m usinf useAnimation hook to play animation
    // Scene.js
    import React, { useRef } from 'react';
    import { useLoader, useFrame } from '@react-three/fiber';
    import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader';
    import * as THREE from 'three'
    import { Canvas } from '@react-three/fiber';
    import { OrbitControls, useAnimations } from '@react-three/drei';
    const Scene = () => {
    const modelRef=useRef()
    const { scene, animations } = useLoader(GLTFLoader, '/SM.glb');
    const { actions } = useAnimations(animations, modelRef);
    console.log("actions animation",actions)
    useFrame((state, delta) => {
    //console.log("useFram runing....")
    actions.Running.play()
    //actions.walking.play()
    });


    return (

    );
    };
    export default Scene