From f2c0a799e90916b980a85ebd110466a5feff1ead Mon Sep 17 00:00:00 2001 From: austin Date: Fri, 30 May 2025 15:08:20 -0400 Subject: [PATCH] dont add contact joints for geom-geom --- docs/src/progress/renderertodo.md | 1 + .../collision/CollisionEngine.java | 37 ++++++------------- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/docs/src/progress/renderertodo.md b/docs/src/progress/renderertodo.md index ad1ff0c9..4f6fde8f 100644 --- a/docs/src/progress/renderertodo.md +++ b/docs/src/progress/renderertodo.md @@ -2079,6 +2079,7 @@ Render pathing nodes (still needs some work) Pathing construction between town buildings and road nodes Pathing construction for farm plots Bounding sphere work +Don't allocate contact joints for geom-geom diff --git a/src/main/java/electrosphere/collision/CollisionEngine.java b/src/main/java/electrosphere/collision/CollisionEngine.java index 89d54720..ed906b52 100644 --- a/src/main/java/electrosphere/collision/CollisionEngine.java +++ b/src/main/java/electrosphere/collision/CollisionEngine.java @@ -486,44 +486,31 @@ public class CollisionEngine { int numc = OdeHelper.collide(o1,o2,MAX_CONTACTS,contacts.getGeomBuffer()); Globals.profiler.endCpuSample(); //create DContacts based on each collision that occurs - if (numc != 0) { - for (int i=0; i 0 - // && - // //force is pointing basically upwards - // PhysicsUtils.odeVecToJomlVec(contact.geom.normal).dot(MathUtils.getUpVector()) > 0.7 - // ){ - // System.out.println(PhysicsUtils.odeVecToJomlVec(contact.geom.normal).dot(MathUtils.getUpVector())); - // if(//force is pointing basically upwards - // PhysicsUtils.odeVecToJomlVec(contact.geom.normal).dot(MathUtils.getUpVector()) > 0.7){ - // contact.geom.normal.set(PhysicsUtils.jomlVecToOdeVec(MathUtils.getUpVector())); - // } - // } - // //add contact to contact group DJoint c = OdeHelper.createContactJoint(world,contactgroup,contact); if(b1 == null){ - c.attach(null,b2); - } else if(b2 == null){ - c.attach(b1,null); + if(b2 == null){ + } else { + c.attach(null,b2); + } } else { - c.attach(b1,b2); + if(b2 == null){ + c.attach(b1,null); + } else { + c.attach(b1,b2); + } } // Use the default collision resolution