Replies: 2 comments 5 replies
-
can you attach your model? |
Beta Was this translation helpful? Give feedback.
1 reply
-
cant reproduce. both local and npx gltfjsx test-animation.glb works.
here's the file it produces: /*
Auto-generated by: https://github.com/pmndrs/gltfjsx
*/
import * as THREE from 'three'
import React, { useRef, useState, useEffect } from 'react'
import { useFrame } from 'react-three-fiber'
import { useGLTF } from '@react-three/drei/useGLTF'
import { PerspectiveCamera } from '@react-three/drei/PerspectiveCamera'
import { useAnimations } from '@react-three/drei/useAnimations'
export default function Model(props) {
const group = useRef()
const { nodes, materials, animations } = useGLTF('/test_animation.gltf')
const { actions } = useAnimations(animations, group)
return (
<group ref={group} {...props} dispose={null}>
<group position={[7.36, 4.96, 6.93]} rotation={[1.24, 0.33, -0.76]}>
<PerspectiveCamera makeDefault={false} far={100} near={0.1} fov={22.9} rotation={[-Math.PI / 2, 0, 0]} />
</group>
<group position={[2.64, 0.71, -1.84]}>
<pointLight intensity={79.3} decay={2} rotation={[-Math.PI / 2, 0, 0]} />
</group>
<mesh
name="Card000"
material={materials.Material}
geometry={nodes.Card000.geometry}
position={[-1.57, 4.08, -1.12]}
scale={[0.01, 0.66, 1.15]}
/>
<mesh
name="Card001"
material={materials['Material.001']}
geometry={nodes.Card001.geometry}
position={[-1.22, 3.68, -1.73]}
scale={[0.01, 0.66, 1.15]}
/>
<mesh
name="Card002"
material={materials['Material.002']}
geometry={nodes.Card002.geometry}
position={[-1.97, 4.08, -1.12]}
scale={[0.01, 0.66, 1.15]}
/>
<mesh
material={materials['Material.003']}
geometry={nodes.Plane.geometry}
position={[0, -1.26, 0]}
rotation={[0, 0, -Math.PI / 2]}
/>
</group>
)
}
useGLTF.preload('/test_animation.gltf') |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to convert a glft to jsx with gltfjsx as usual, but now I'm getting the unexpected token '.' . Even with the gltfjsx repository or the files that I had converted.
Im using:
Node v12.18.1,
React: 17.0.1
Thx for any idea
Beta Was this translation helpful? Give feedback.
All reactions