I would like to use the current physic engine of Needle for my project, I need to move tooth, and I want to manage collision with an offset between collision.
I would like to had a mesh collider but I got an error (surely because my mesh doesn’t have one), so how could I generate this custom mesh collider by myself ?
Additionally, I tried tests with BoxCollider but when I move a mesh, the collision make it go far away and I only want that my mesh move to a position where there is no collision, I don’t want a speed movement added to my mesh.
I forgot how to see physics for debugging, I tried debugphysics in my url but it doesn’t work
I forgot how to see physics for debugging, I tried debugphysics in my url but it doesn’t work showcolliders - to visualize colliders, possibly if you feel the scene is too bussy, you could try wireframe as well. debugcollisions - extra logs debugcolliderplacement - i think this freezes every collider inplace. debugphysics - extra logs
You dont have to generate a custom mesh. Either assign one in unity to the meshcollider component or not - if none is assigned the mesh from the renderer will be used. Do you perhaps have a multimaterial object? And please include exact error messages (“i get an error” does not help)
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'length')
at q (rapier_wasm3d.js:133:28)
at _.trimesh (rapier_wasm3d.js:3830:22)
at oI.intoRaw (shape.ts:817:25)
at MI.createCollider (collider_set.ts:65:35)
at sI.createCollider (world.ts:342:31)
at _RapierPhysics.createCollider (engine_physics_rapier.ts:653:32)
at _RapierPhysics.addMeshCollider (engine_physics_rapier.ts:583:30)
at MeshCollider.onEnable (Collider.ts:93:42)
at MeshCollider.__internalEnable (Component.ts:499:14)
at set enabled [as enabled] (Component.ts:554:18)
In fact, I’d like to point out that the tooth models I load are not very common because the mesh vertex locations are not in the centre of the object.
This explains why the mesh collider is offset from the vertex.
The explosion in question comes from the fact that the boxes are all in the same place at the start.
Unfortunately I can’t replace them.
Hence the fact that I need a mesh collider so that it can be positioned on the vertices and not on the origin of the mesh position (which is always 0 0 0).
You can set the mesh collider like so meshCollider.sharedMesh = xyz
and you can obtain it from a MeshRenderer by meshRenderer.sharedMesh
I presume every tooth is a unique mesh, otherwise you could run into issues due to the meshes being reused.