Closed HugoMcPhee closed 4 years ago
Hi thanks for this library and the latest typescript updates in 2.0,
This PR adds typescript support for animations tested with:
The main changes are:
root bones are added to the GLTFResult type
type GLTFResult = GLTF & { nodes: { fox: THREE.SkinnedMesh _rootJoint: THREE.Bone } materials: { fox_material: THREE.MeshStandardMaterial } }
which removes type errors for <primitive object={nodes._rootJoint} />
<primitive object={nodes._rootJoint} />
an ActionName and GLTFActions type are added
type ActionName = 'Survey' | 'Walk' | 'Run' type GLTFActions = Record<ActionName, THREE.AnimationAction>
default values/types are given to actions and mixer
const actions = useRef(null as null | GLTFActions) const [mixer] = useState(() => new THREE.AnimationMixer(nodes.fox))
the mixer uses the first skinned mesh it finds, otherwise null
Note: the "npx lint-staged" isn't required, and was due to having trouble commiting
nice, thanks!
Hi thanks for this library and the latest typescript updates in 2.0,
This PR adds typescript support for animations tested with:
The main changes are:
root bones are added to the GLTFResult type
which removes type errors for
<primitive object={nodes._rootJoint} />
an ActionName and GLTFActions type are added
default values/types are given to actions and mixer
the mixer uses the first skinned mesh it finds, otherwise null
Note: the "npx lint-staged" isn't required, and was due to having trouble commiting