the bin file is the whole map[it has roads, buildings, trees, e.t.c.]
in 3ds max i gave you the faulty mesh, other meshes on that map work fine(you can see it from the video)
in previous rar file i also gave you dae file, which you can open with openCollada plugin for 3ds max, or with collada viewer you can convert it to obj,3ds.
i serialized the file the same way you did in the demossandbox:
- Code: Select all
void BodySerialization(NewtonBody* const body, NewtonSerializeCallback serializeCallback, void* const serializeHandle)
{
// here the use can save information of this body, ex:
// a string naming the body,
// serialize the visual mesh, or save a link to the visual mesh
// save labels for looking up the body call backs
// for the demos I will simple write three stream to identify what body it is, the application can do anything
const char* const bodyIndentification = "gravityBody\0\0\0\0";
int size = (strlen(bodyIndentification) + 3) & -4;
serializeCallback(serializeHandle, &size, sizeof (size));
serializeCallback(serializeHandle, bodyIndentification, size);
}
void SerializeFile(void* const serializeHandle, const void* const buffer, int size)
{
// check that each chunk is a multiple of 4 bytes, this is useful for easy little to big Indian conversion
dAssert((size & 0x03) == 0);
fwrite(buffer, size, 1, (FILE*)serializeHandle);
}
...
FILE* const file = fopen("scene.bin", "wb");
int bodyCount = NewtonWorldGetBodyCount(nworld);
NewtonBody** array = new NewtonBody*[bodyCount];
int index = 0;
for (NewtonBody* body = NewtonWorldGetFirstBody(nworld); body; body = NewtonWorldGetNextBody(nworld, body)) {
array[index] = body;
index++;
dAssert(index <= bodyCount);
}
NewtonSerializeBodyArray(nworld, array, bodyCount, BodySerialization, SerializeFile, file);
delete[] array;
fclose(file);
i also have another question, does newton have "collision tolerance" value similar to havok/bullet?
i figured the possible reason for the problem, it's clockwise polygons
on road they are inverted, so if i disable plane underneath the road the geometry falls right though road, is it possible to enable some CCW flag on newtonmesh, so it would enable polygons from both sides?
when i put boxes on the edges it work, between edges it fall through
i'm experimenting with newton for performance/stability testing, and to replace current raycast vehicles with newton joint based implementation.