Exception creating convex hull
Posted: Sun Jan 19, 2014 2:49 pm
I'm starting to write a space game using Monogame, and so far have an asteroid field you can fly through - however currently you can fly right through the asteroids! Next step is to put BEPUphysics in - and my first stage was to try and make a convex hull for the asteroid. So I've just taken the points I'm using for display (136 vertices) and made Bepu Vector3s and passed them to ConvexHull and I get:
Argument Exception: "Invalid distance: mesh may not be concave, winding may not be consistent, or the center may be outside the mesh."
(This comes from InertiaHelper.ComputeMinimumRadius )
The code is just like:
(Note the "model" used above is one of my own design - Monogame doesn't have a content pipeline so I'm just reading points from a file with JSON data in for now! I could PM the point data if it helps?)
I'm I not right in assuming you can pass an arbitrary cloud of points to the algorithm and have it generate a convex hull?
Argument Exception: "Invalid distance: mesh may not be concave, winding may not be consistent, or the center may be outside the mesh."
(This comes from InertiaHelper.ComputeMinimumRadius )
The code is just like:
Code: Select all
var inVerts = model.MeshData.Meshes[0].Vertices;
IList<BEPUutilities.Vector3> physverts = inVerts.Select(x => new BEPUutilities.Vector3((float) x.x, (float) x.y, (float) x.z)).ToList();
ConvexHull cvh = new ConvexHull(BEPUutilities.Vector3.Zero, physverts, 100f);
I'm I not right in assuming you can pass an arbitrary cloud of points to the algorithm and have it generate a convex hull?