small collision engine formatting
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good

This commit is contained in:
austin 2024-12-03 22:58:00 -05:00
parent 8147a21f2d
commit 85f0652d4f
2 changed files with 5 additions and 13 deletions

View File

@ -1239,6 +1239,7 @@ Store terrain chunk files in dedicated folder
Start to standardize on doubles for positional data Start to standardize on doubles for positional data
Fix placing character at end of world bounds Fix placing character at end of world bounds
Bump ode4j version Bump ode4j version
Small collision engine code formatting

View File

@ -1,13 +1,5 @@
package electrosphere.collision; package electrosphere.collision;
// import static org.ode4j.ode.OdeConstants.dContactBounce;
// import static org.ode4j.ode.OdeConstants.dContactSoftCFM;
// import static org.ode4j.ode.OdeConstants.dInfinity;
import static org.ode4j.ode.OdeHelper.areConnectedExcluding;
// import static org.ode4j.ode.OdeMath.dCalcVectorLengthSquare3;
// import static org.ode4j.ode.OdeMath.dSubtractVectors3;
// import static org.ode4j.ode.internal.Common.dRecip;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
@ -146,11 +138,11 @@ public class CollisionEngine {
*/ */
public CollisionEngine(){ public CollisionEngine(){
world = OdeHelper.createWorld(); world = OdeHelper.createWorld();
space = OdeHelper.createBHVSpace(Collidable.TYPE_STATIC_BIT);
world.setGravity(0,-GRAVITY_MAGNITUDE,0); world.setGravity(0,-GRAVITY_MAGNITUDE,0);
space = OdeHelper.createBHVSpace(Collidable.TYPE_STATIC_BIT);
// world.setContactMaxCorrectingVel(0.1); // world.setContactMaxCorrectingVel(0.1);
// world.setContactSurfaceLayer(0.001); // world.setContactSurfaceLayer(0.001);
world.setCFM(1e-5); // world.setCFM(1e-10);
//base plane //base plane
OdeHelper.createPlane(space, 0, 1, 0, 0); OdeHelper.createPlane(space, 0, 1, 0, 0);
@ -313,13 +305,13 @@ public class CollisionEngine {
* @param o1 the first collision body * @param o1 the first collision body
* @param o2 the second collision body * @param o2 the second collision body
*/ */
private void nearCallback (Object data, DGeom o1, DGeom o2) { private void nearCallback(Object data, DGeom o1, DGeom o2){
// if (o1->body && o2->body) return; // if (o1->body && o2->body) return;
// exit without doing anything if the two bodies are connected by a joint // exit without doing anything if the two bodies are connected by a joint
DBody b1 = o1.getBody(); DBody b1 = o1.getBody();
DBody b2 = o2.getBody(); DBody b2 = o2.getBody();
if (b1!=null && b2!=null && areConnectedExcluding (b1,b2,DContactJoint.class)){ if(b1 != null && b2 != null && OdeHelper.areConnectedExcluding(b1,b2,DContactJoint.class)){
return; return;
} }
@ -682,7 +674,6 @@ public class CollisionEngine {
if(bodies.size() > COLLIDABLE_COUNT_WARNING_THRESHOLD){ if(bodies.size() > COLLIDABLE_COUNT_WARNING_THRESHOLD){
LoggerInterface.loggerEngine.WARNING("Body count has superceded the warning threshold! " + bodies.size()); LoggerInterface.loggerEngine.WARNING("Body count has superceded the warning threshold! " + bodies.size());
} }
// OdeHelper.createBody(world);
} }
} }