No it does still not optimize.
There you can see the collision mesh:
Moderators: Sascha Willems, walaber
void DebugShowGeometryCollisionImp (void* userData, int vertexCount, const dFloat* faceVertec, int id)
{
int ii = vertexCount - 1;
dVector p0(faceVertec[ii * 3], faceVertec[ii * 3 + 1], faceVertec[ii * 3 + 2]);
for (int i = 0; i < vertexCount; i ++) {
dVector p1 (faceVertec[i * 3], faceVertec[i * 3 + 1], faceVertec[i * 3 + 2]);
Vector3 s,e;
s.x = p0.m_x;
s.y = p0.m_y;
s.z = p0.m_z;
e.x = p1.m_x;
e.y = p1.m_y;
e.z = p1.m_z;
g_pLine->AddLine(s, e, Color(1.0f,0.0f,0.55f));
p0 = p1;
}
}
void dgCollisionBVH::EndBuild(dgInt32 optimize)
{
dgVector p0;
dgVector p1;
bool state = optimize ? true : false;
// place a break point here and check the m_faceCount before and after the call to end
m_builder->End(state);
Create (*m_builder, state);
GetAABB (p0, p1);
SetCollisionBBox (p0, p1);
delete m_builder;
m_builder = NULL;
}
PhysicBody* RigidBodyHandler::CreateLevelRigidBody(Model* CollisionModel, Matrix mTranslation, bool bOptimize)
{
..
for(int i = 0; i < indexcount; i += 3)
{
..
// here you are passing a unique material ID to each triangle
NewtonTreeCollisionAddFace(collision, 3, (float*)vArray[0], sizeof(Vector3), i+1);
}
}
Users browsing this forum: No registered users and 1 guest