three.js FBX Loader

joohyo1·2024년 1월 13일

모듈 가져오기

import { FBXLoader } from 'three/addons/loaders/FBXLoader.js';

모델 로드하기

// model
	const loader = new FBXLoader();
	loader.load( 'models/fbx/Samba Dancing.fbx', function ( object ) {

	mixer = new THREE.AnimationMixer( object );

	const action = mixer.clipAction( object.animations[ 0 ] );
	action.play();

	object.traverse( function ( child ) {

	if ( child.isMesh ) {

			child.castShadow = true;
			child.receiveShadow = true;

			}

			} );

		scene.add( object );

		} );

애니메이션

function animate() {

				requestAnimationFrame( animate );

				const delta = clock.getDelta();

				if ( mixer ) mixer.update( delta );

				renderer.render( scene, camera );

				stats.update();

			}
profile
트라이 에브리띠이잉

0개의 댓글