- Home /
Setting Mesh Colliders convex through script
I keep getting these 2 errors when trying to set convex to true on a procedurally created mesh. What do they mean and how would I try to fix them?
It's beside the point, but may I ask why you don't set the collider to convex in the first place?
I am creating the GameObjects at runtime and adding a mesh to them in runtime aswell, so it made the most sense at the time being.
EDIT: And for some reason if I change the mesh at runtime after setting convex it becomes invisible
Answer by Bunny83 · Apr 22, 2016 at 11:14 AM
Well, the error is quite clear: Your mesh most likely doesn't represent a volume. A 3D convex hull can only be created if the mesh represents a volume. For example when you attach a meshcollider to a default Plane or Quad mesh and select convex you would get a similar error. Make sure your mesh vertices don't lie in the same plane. To actually be able to form a volume you need at least 4 vertices in your mesh. 3 vertices will always form a plane so at least one other vertex need to be off that plane. The simplest volume is a Tetrahedron / Simplex
Your answer
Follow this Question
Related Questions
Problem with convex Mesh Colliders 0 Answers
How to remove internal triangle/faces when combining mesh 0 Answers
Problem with collision detection in an animated object 1 Answer
Make mesh collider constantly change 1 Answer
Mesh Collider Issue(?) - Raycast (ScreenPointToRay) Appears to Collide on Nothing 0 Answers