I was wondering if it was possible to make a mesh out of a 3d model…I have a character controller…but it only works with a THREE.mesh not a GlTF
If by character controller you are referring to a physics engine handler, you can create an independent Mesh that roughly wrap you model, a Capsule or a Box for example, and copy the Mesh transformations (Position/Rotation) to your model.
What most models consist of is a tree of THREE.Group or THREE.Object3D instances, containing one or more THREE.Mesh instances. There is no format-specific “GLTF” thing that three.js can render, it’s all converted to the normal classes you see in the three.js docs.
For example try…
model.traverse((object) => {
console.log(object.type);
});
… and you’ll see what your model contains. If there’s just a SkinnedMesh, with some bones and parent groups, you can probably use your character controller with that. If there are multiple meshes then you’d need to think carefully about what “make a mesh” means in your context, and whether you intend to render or just do collisions with that mesh. Perhaps your character controller can be adapted to work with a THREE.Group.
Yes thank you! I actually realized my issue and its simpler than I thought… However I do have some issues in my code. I made a question here on the forum about it: GHAAAA! Why does this produce an error? - Questions - three.js forum (threejs.org)