-
Hi devs, I am having issues after updating r3f and threejs. Since I can no longer use Now I use This is what I am returning right now. return <group>
<skinnedMesh
geometry={gltf.nodes.Beard.geometry}
skeleton={gltf.nodes.Beard.skeleton}
material={gltf.nodes.Beard.material}/>
</group> and this is how I reposition the bones on a mesh export function RepositionBone(index: number, bone: any, geometry: BufferGeometry) {
if (geometry) {
const positionAttribute: BufferAttribute = geometry.getAttribute('position') as BufferAttribute
let vertex = new THREE.Vector3()
vertex.fromBufferAttribute(positionAttribute, index)
bone.position.set(vertex.x, vertex.y, vertex.z)
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
three broke __$ because index is now a race condition, they made it async, first thing that loads get 0, and so on. primitive will never dispose data because it's always external. but when you unmount the model cant possibly stay in the scene unless you have mutated something (calling add/removing imperatively etc). that this happens points to a real issue in your code. i think you should consider gltfjsx which handles all that for you. here's an example of a skinned model that's being re-used https://codesandbox.io/s/gltf-animations-re-used-k8phr |
Beta Was this translation helpful? Give feedback.
three broke __$ because index is now a race condition, they made it async, first thing that loads get 0, and so on. primitive will never dispose data because it's always external. but when you unmount the model cant possibly stay in the scene unless you have mutated something (calling add/removing imperatively etc). that this happens points to a real issue in your code.
i think you should consider gltfjsx which handles all that for you. here's an example of a skinned model that's being re-used https://codesandbox.io/s/gltf-animations-re-used-k8phr