Hey compass3.
So I didn't expose the cpPolyValidate() function to Unity because I didn't think people would actually want to use it. Chipmunk automatically creates a convex hull out of your input points like Unity does when using convex mesh colliders.
So there are two things that cpPolyValidate() does. It checks that the points are convex, that the points have a clockwise winding. When creating a polygon shape from a bunch of points, the hull property will contain be exactly that, the set of convex points with a clockwise winding. The point it picks for the first vertex is the hull is the leftmost one, ties are broken by picking the bottommost.
If you just want to check for concavity, then comparing the arrays' sizes is sufficient. Comparing the winding is harder since you need to figure out which is the first vertex in the hull array. Alternatively, if the array sizes are the same, you can just compare the first three vertexes in the array to check the winding. Check if the 2D cross product analog is positive or negative. (Do a 3D cross product and only look at the z-value) I forget which direction is which off the top of my head though.
All said and done... it might just be easiest to port cpPolyValidate() to Unity. It's a pretty short function, so it would only take a minute or two.
https://github.com/slembcke/Chipmunk2D/ ... ape.c#L150
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/