I found this post that mentions concave real time collision detection, and an answer about three-mesh-bvh. I have came across this package before, but never used it.
I tried to apply the solution to .intersectsGeometry and it worked perfectly with meshes. Since I used bounding boxes before I really couldn’t have collision detection when rotating an object.
I tried to apply the same solution to glb models but it seems that my application really slows down while applying it. Basically I divided glb into its meshes and then used their geometry to look for the collision. Is there any better way to go on about this?
Here is my code:
Basically I have an “ids” array which holds all collider ids, then a mesh array which holds an array of meshes of a certain gltf model.
The function’s input is a copied gltf model with the position I want to put my gltf model in, and if there is no collision then my real model is put to that position, if there is a collision with a copied model, my model stays in the same place.
Do you have any idea on how to improve this algorithm?
Thank you.