dont add contact joints for geom-geom
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2025-05-30 15:08:20 -04:00
parent cc40718f42
commit f2c0a799e9
2 changed files with 13 additions and 25 deletions

View File

@ -2079,6 +2079,7 @@ Render pathing nodes (still needs some work)
Pathing construction between town buildings and road nodes Pathing construction between town buildings and road nodes
Pathing construction for farm plots Pathing construction for farm plots
Bounding sphere work Bounding sphere work
Don't allocate contact joints for geom-geom

View File

@ -486,44 +486,31 @@ public class CollisionEngine {
int numc = OdeHelper.collide(o1,o2,MAX_CONTACTS,contacts.getGeomBuffer()); int numc = OdeHelper.collide(o1,o2,MAX_CONTACTS,contacts.getGeomBuffer());
Globals.profiler.endCpuSample(); Globals.profiler.endCpuSample();
//create DContacts based on each collision that occurs //create DContacts based on each collision that occurs
if (numc != 0) { if(numc != 0){
for (int i=0; i<numc; i++) { for(int i=0; i<numc; i++){
DContact contact = contacts.get(i); DContact contact = contacts.get(i);
//special code for ray casting //special code for ray casting
if (o1 instanceof DRay || o2 instanceof DRay){ if (o1 instanceof DRay || o2 instanceof DRay){
DVector3 end = new DVector3(); DVector3 end = new DVector3();
end.eqSum( contact.geom.pos, contact.geom.normal, contact.geom.depth ); end.eqSum(contact.geom.pos, contact.geom.normal, contact.geom.depth);
continue; continue;
} }
// //
// //apply shallow slope correction
// if(
// //is terrain
// (c1.getType() == Collidable.TYPE_TERRAIN || c2.getType() == Collidable.TYPE_TERRAIN) &&
// (!c1.getType().equals(c2.getType())) &&
// contact.geom.normal.length() > 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 //add contact to contact group
DJoint c = OdeHelper.createContactJoint(world,contactgroup,contact); DJoint c = OdeHelper.createContactJoint(world,contactgroup,contact);
if(b1 == null){ if(b1 == null){
c.attach(null,b2); if(b2 == null){
} else if(b2 == null){ } else {
c.attach(b1,null); c.attach(null,b2);
}
} else { } else {
c.attach(b1,b2); if(b2 == null){
c.attach(b1,null);
} else {
c.attach(b1,b2);
}
} }
// Use the default collision resolution // Use the default collision resolution