From 53f5df5a3f2c1a8d8683df05871df627c67d3b93 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Fri, 22 Apr 2011 19:17:04 +0000 Subject: [PATCH] - add logging for adding and removing of objects to PhysicsSpace - rename PhysicsJoint.getConstraint() to getObjectId() preparing for native bullet git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7284 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../src/jbullet/com/jme3/bullet/PhysicsSpace.java | 15 +++++++++++++-- .../com/jme3/bullet/joints/PhysicsJoint.java | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/engine/src/jbullet/com/jme3/bullet/PhysicsSpace.java b/engine/src/jbullet/com/jme3/bullet/PhysicsSpace.java index 40c4dbc83..bd55044cb 100644 --- a/engine/src/jbullet/com/jme3/bullet/PhysicsSpace.java +++ b/engine/src/jbullet/com/jme3/bullet/PhysicsSpace.java @@ -72,6 +72,7 @@ import com.jme3.bullet.collision.PhysicsSweepTestResult; import com.jme3.bullet.collision.shapes.CollisionShape; import com.jme3.bullet.control.PhysicsControl; import com.jme3.bullet.control.RigidBodyControl; +import com.jme3.bullet.control.VehicleControl; import com.jme3.bullet.joints.PhysicsJoint; import com.jme3.bullet.objects.PhysicsGhostObject; import com.jme3.bullet.objects.PhysicsCharacter; @@ -534,20 +535,24 @@ public class PhysicsSpace { } private void addGhostObject(PhysicsGhostObject node) { + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Adding ghost object {0} to physics space.", node.getObjectId()); dynamicsWorld.addCollisionObject(node.getObjectId()); } private void removeGhostObject(PhysicsGhostObject node) { + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Removing ghost object {0} from physics space.", node.getObjectId()); dynamicsWorld.removeCollisionObject(node.getObjectId()); } private void addCharacter(PhysicsCharacter node) { + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Adding character {0} to physics space.", node.getObjectId()); // dynamicsWorld.addCollisionObject(node.getObjectId()); dynamicsWorld.addCollisionObject(node.getObjectId(), CollisionFilterGroups.CHARACTER_FILTER, (short) (CollisionFilterGroups.STATIC_FILTER | CollisionFilterGroups.DEFAULT_FILTER)); dynamicsWorld.addAction(node.getControllerId()); } private void removeCharacter(PhysicsCharacter node) { + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Removing character {0} from physics space.", node.getObjectId()); dynamicsWorld.removeAction(node.getControllerId()); dynamicsWorld.removeCollisionObject(node.getObjectId()); } @@ -555,7 +560,9 @@ public class PhysicsSpace { private void addRigidBody(PhysicsRigidBody node) { physicsNodes.put(node.getObjectId(), node); dynamicsWorld.addRigidBody(node.getObjectId()); + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Adding RigidBody {0} to physics space.", node.getObjectId()); if (node instanceof PhysicsVehicle) { + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Adding vehicle constraint {0} to physics space.", ((PhysicsVehicle) node).getVehicleId()); ((PhysicsVehicle) node).createVehicle(this); dynamicsWorld.addVehicle(((PhysicsVehicle) node).getVehicleId()); } @@ -563,20 +570,24 @@ public class PhysicsSpace { private void removeRigidBody(PhysicsRigidBody node) { if (node instanceof PhysicsVehicle) { + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Removing vehicle constraint {0} from physics space.", ((PhysicsVehicle) node).getVehicleId()); dynamicsWorld.removeVehicle(((PhysicsVehicle) node).getVehicleId()); } + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Removing RigidBody {0} from physics space.", node.getObjectId()); physicsNodes.remove(node.getObjectId()); dynamicsWorld.removeRigidBody(node.getObjectId()); } private void addJoint(PhysicsJoint joint) { + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Adding Joint {0} to physics space.", joint.getObjectId()); physicsJoints.add(joint); - dynamicsWorld.addConstraint(joint.getConstraint(), !joint.isCollisionBetweenLinkedBodys()); + dynamicsWorld.addConstraint(joint.getObjectId(), !joint.isCollisionBetweenLinkedBodys()); } private void removeJoint(PhysicsJoint joint) { + Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Removing Joint {0} from physics space.", joint.getObjectId()); physicsJoints.remove(joint); - dynamicsWorld.removeConstraint(joint.getConstraint()); + dynamicsWorld.removeConstraint(joint.getObjectId()); } /** diff --git a/engine/src/jbullet/com/jme3/bullet/joints/PhysicsJoint.java b/engine/src/jbullet/com/jme3/bullet/joints/PhysicsJoint.java index 728a3c660..d5c119acb 100644 --- a/engine/src/jbullet/com/jme3/bullet/joints/PhysicsJoint.java +++ b/engine/src/jbullet/com/jme3/bullet/joints/PhysicsJoint.java @@ -77,7 +77,7 @@ public abstract class PhysicsJoint implements Savable { /** * @return the constraint */ - public TypedConstraint getConstraint() { + public TypedConstraint getObjectId() { return constraint; }