From b48426d6c438503d06f0bbcb91a8050aa27492a8 Mon Sep 17 00:00:00 2001 From: Rtch90 <ritchie.cunningham@protonmail.com> Date: Sun, 19 Nov 2017 17:43:43 +0000 Subject: [PATCH] [Change] Messing around with collisions some more, not really helpful. --- src/space.cpp | 3 +-- src/static_rigid_body.cpp | 20 ++------------------ 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/src/space.cpp b/src/space.cpp index 44c1720..06f9ba9 100644 --- a/src/space.cpp +++ b/src/space.cpp @@ -156,7 +156,7 @@ static bool _OnCollision(dGeomID g1, dGeomID g2, Object* o1, Object* o2, static void nearCallback(void* data, dGeomID oO, dGeomID o1) { /* Create an array of dContact objects to hold the contact joints. */ - static const int MAX_CONTACTS = 20; + static const int MAX_CONTACTS = 100; dContact contact[MAX_CONTACTS]; for(int i = 0; i < MAX_CONTACTS; i++) { @@ -186,7 +186,6 @@ static void nearCallback(void* data, dGeomID oO, dGeomID o1) { * finally create the temp contact joint between the two geom bodies. */ dJointID c = dJointCreateContact(Space::world, _contactgroup, contact + i); - printf("Depth: %f\n", contact[i].geom.depth); #if 0 struct dContactGeom { dVector3 pos; /* Constact position. */ diff --git a/src/static_rigid_body.cpp b/src/static_rigid_body.cpp index 0992506..4a6e9a5 100644 --- a/src/static_rigid_body.cpp +++ b/src/static_rigid_body.cpp @@ -38,26 +38,10 @@ void StaticRigidBody::SetGeomFromSBREModel(int sbreModel, ObjParams* params) { sbreCollMesh->pVertex[i] = -sbreCollMesh->pVertex[i]; sbreCollMesh->pVertex[i+2] = -sbreCollMesh->pVertex[i+2]; } - /* Make normals. */ - meshNormals = new float[sbreCollMesh->ni]; - for(int i = 0; i < sbreCollMesh->ni; i += 3) { - float* vtx1 = sbreCollMesh->pVertex + 3*sbreCollMesh->pIndex[i]; - float* vtx2 = sbreCollMesh->pVertex + 3*sbreCollMesh->pIndex[i+1]; - float* vtx3 = sbreCollMesh->pVertex + 3*sbreCollMesh->pIndex[i+2]; - vector3f v1(vtx1[0], vtx1[1], vtx1[2]); - vector3f v2(vtx2[0], vtx2[1], vtx2[2]); - vector3f v3(vtx3[0], vtx3[1], vtx3[2]); - vector3f n = vector3f::Cross(v1-v2, v1-v3); - n.Normalize(); - meshNormals[i] = n.x; - meshNormals[i+1] = n.y; - meshNormals[i+2] = n.z; - - } dTriMeshDataID triMeshDataID = dGeomTriMeshDataCreate(); - dGeomTriMeshDataBuildSingle1(triMeshDataID, (void*)sbreCollMesh->pVertex, + dGeomTriMeshDataBuildSingle(triMeshDataID, (void*)sbreCollMesh->pVertex, 3*sizeof(float), sbreCollMesh->nv, (void*)sbreCollMesh->pIndex, - sbreCollMesh->ni, 3*sizeof(int), NULL/*meshNormals*/); + sbreCollMesh->ni, 3*sizeof(int)); /* TODO: Leaking StaticRigidBody m_geom. */ m_geom = dCreateTriMesh(0, triMeshDataID, NULL, NULL, NULL);