I got back into some physics game coding and, of course, went straight to the Newton SVN
Everything works great, except for one thing: when I use NewtonCollisionForEachPolygonDo() to generate geometry for a cylinder or a cone, the base(s) is/are not capped:
Here's my code:
- Code: Select all
Mesh mesh = new Mesh(); // this is my own graphics Mesh which accepts vertices and indices
uint currentIndex = 0;
NewtonCollisionIterator func = (userData, vertexCount, faceArray, faceId) =>
{
uint[] indices = new uint[vertexCount];
for (int i = 0; i < vertexCount; ++i)
{
mesh.AddVertex(faceArray[i * 3], faceArray[i * 3 + 1], faceArray[i * 3 + 2], 0, 0, 0, 0, 0);
indices[i] = currentIndex + (uint)i;
}
mesh.AddFace(indices);
currentIndex += (uint)vertexCount;
};
float* f = Util.IdentityFloat16();
NewtonCollisionForEachPolygonDo(collision, f, func, 0);
(the language is C#, not C/C++, but it's close enough to understand)
Is this expected behavior, or is it a bug? All of the other primitives (spheres, capsules, boxes) work fine.
Any help is appreciated, thanks!