Розмір відео: 1280 X 720853 X 480640 X 360
Показувати елементи керування програвачем
Автоматичне відтворення
Автоповтор
//mode1.jsx --------> here i m usinf useAnimation hook to play animation// Scene.jsimport 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
//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