ソースを参照

- remove physics debug implementation in favor of debug AppState (WIP)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10334 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
nor..67 12 年 前
コミット
3fc8b7701a

+ 0 - 9
engine/src/bullet-common/com/jme3/bullet/control/CharacterControl.java

@@ -174,15 +174,6 @@ public class CharacterControl extends PhysicsCharacter implements PhysicsControl
     }
 
     public void render(RenderManager rm, ViewPort vp) {
-        if (enabled && space != null && space.getDebugManager() != null) {
-            if (debugShape == null) {
-                attachDebugShape(space.getDebugManager());
-            }
-            debugShape.setLocalTranslation(getPhysicsLocation());
-            debugShape.updateLogicalState(0);
-            debugShape.updateGeometricState();
-            rm.renderScene(debugShape, vp);
-        }
     }
 
     public void setPhysicsSpace(PhysicsSpace space) {

+ 0 - 10
engine/src/bullet-common/com/jme3/bullet/control/GhostControl.java

@@ -147,16 +147,6 @@ public class GhostControl extends PhysicsGhostObject implements PhysicsControl {
     }
 
     public void render(RenderManager rm, ViewPort vp) {
-        if (enabled && space != null && space.getDebugManager() != null) {
-            if (debugShape == null) {
-                attachDebugShape(space.getDebugManager());
-            }
-            debugShape.setLocalTranslation(spatial.getWorldTranslation());
-            debugShape.setLocalRotation(spatial.getWorldRotation());
-            debugShape.updateLogicalState(0);
-            debugShape.updateGeometricState();
-            rm.renderScene(debugShape, vp);
-        }
     }
 
     public void setPhysicsSpace(PhysicsSpace space) {

+ 0 - 32
engine/src/bullet-common/com/jme3/bullet/control/KinematicRagdollControl.java

@@ -35,7 +35,6 @@ import com.jme3.animation.AnimControl;
 import com.jme3.animation.Bone;
 import com.jme3.animation.Skeleton;
 import com.jme3.animation.SkeletonControl;
-import com.jme3.asset.AssetManager;
 import com.jme3.bullet.PhysicsSpace;
 import com.jme3.bullet.collision.PhysicsCollisionEvent;
 import com.jme3.bullet.collision.PhysicsCollisionListener;
@@ -534,22 +533,6 @@ public class KinematicRagdollControl implements PhysicsControl, PhysicsCollision
         return enabled;
     }
 
-    protected void attachDebugShape(AssetManager manager) {
-        for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) {
-            PhysicsBoneLink physicsBoneLink = it.next();
-            physicsBoneLink.rigidBody.createDebugShape(manager);
-        }
-        debug = true;
-    }
-
-    protected void detachDebugShape() {
-        for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) {
-            PhysicsBoneLink physicsBoneLink = it.next();
-            physicsBoneLink.rigidBody.detachDebugShape();
-        }
-        debug = false;
-    }
-
     /**
      * For internal use only
      * specific render for the ragdoll(if debugging)      
@@ -557,21 +540,6 @@ public class KinematicRagdollControl implements PhysicsControl, PhysicsCollision
      * @param vp 
      */
     public void render(RenderManager rm, ViewPort vp) {
-        if (enabled && space != null && space.getDebugManager() != null) {
-            if (!debug) {
-                attachDebugShape(space.getDebugManager());
-            }
-            for (Iterator<PhysicsBoneLink> it = boneLinks.values().iterator(); it.hasNext();) {
-                PhysicsBoneLink physicsBoneLink = it.next();
-                Spatial debugShape = physicsBoneLink.rigidBody.debugShape();
-                if (debugShape != null) {
-                    debugShape.setLocalTranslation(physicsBoneLink.rigidBody.getMotionState().getWorldLocation());
-                    debugShape.setLocalRotation(physicsBoneLink.rigidBody.getMotionState().getWorldRotationQuat());
-                    debugShape.updateGeometricState();
-                    rm.renderScene(debugShape, vp);
-                }
-            }
-        }
     }
 
     /**

+ 0 - 11
engine/src/bullet-common/com/jme3/bullet/control/RigidBodyControl.java

@@ -230,17 +230,6 @@ public class RigidBodyControl extends PhysicsRigidBody implements PhysicsControl
     }
 
     public void render(RenderManager rm, ViewPort vp) {
-        if (enabled && space != null && space.getDebugManager() != null) {
-            if (debugShape == null) {
-                attachDebugShape(space.getDebugManager());
-            }
-            //TODO: using spatial traslation/rotation..
-            debugShape.setLocalTranslation(spatial.getWorldTranslation());
-            debugShape.setLocalRotation(spatial.getWorldRotation());
-            debugShape.updateLogicalState(0);
-            debugShape.updateGeometricState();
-            rm.renderScene(debugShape, vp);
-        }
     }
 
     public void setPhysicsSpace(PhysicsSpace space) {

+ 0 - 46
engine/src/bullet-common/com/jme3/bullet/control/VehicleControl.java

@@ -43,11 +43,9 @@ import com.jme3.math.Quaternion;
 import com.jme3.math.Vector3f;
 import com.jme3.renderer.RenderManager;
 import com.jme3.renderer.ViewPort;
-import com.jme3.scene.Geometry;
 import com.jme3.scene.Node;
 import com.jme3.scene.Spatial;
 import com.jme3.scene.control.Control;
-import com.jme3.scene.debug.Arrow;
 import java.io.IOException;
 import java.util.Iterator;
 
@@ -201,51 +199,7 @@ public class VehicleControl extends PhysicsVehicle implements PhysicsControl {
         }
     }
 
-    @Override
-    protected Spatial getDebugShape() {
-        return super.getDebugShape();
-    }
-
     public void render(RenderManager rm, ViewPort vp) {
-        if (enabled && space != null && space.getDebugManager() != null) {
-            if (debugShape == null) {
-                attachDebugShape(space.getDebugManager());
-            }
-            Node debugNode = (Node) debugShape;
-            debugShape.setLocalTranslation(spatial.getWorldTranslation());
-            debugShape.setLocalRotation(spatial.getWorldRotation());
-            int i = 0;
-            for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) {
-                VehicleWheel physicsVehicleWheel = it.next();
-                Vector3f location = physicsVehicleWheel.getLocation().clone();
-                Vector3f direction = physicsVehicleWheel.getDirection().clone();
-                Vector3f axle = physicsVehicleWheel.getAxle().clone();
-                float restLength = physicsVehicleWheel.getRestLength();
-                float radius = physicsVehicleWheel.getRadius();
-
-                Geometry locGeom = (Geometry) debugNode.getChild("WheelLocationDebugShape" + i);
-                Geometry dirGeom = (Geometry) debugNode.getChild("WheelDirectionDebugShape" + i);
-                Geometry axleGeom = (Geometry) debugNode.getChild("WheelAxleDebugShape" + i);
-                Geometry wheelGeom = (Geometry) debugNode.getChild("WheelRadiusDebugShape" + i);
-
-                Arrow locArrow = (Arrow) locGeom.getMesh();
-                locArrow.setArrowExtent(location);
-                Arrow axleArrow = (Arrow) axleGeom.getMesh();
-                axleArrow.setArrowExtent(axle.normalizeLocal().multLocal(0.3f));
-                Arrow wheelArrow = (Arrow) wheelGeom.getMesh();
-                wheelArrow.setArrowExtent(direction.normalizeLocal().multLocal(radius));
-                Arrow dirArrow = (Arrow) dirGeom.getMesh();
-                dirArrow.setArrowExtent(direction.normalizeLocal().multLocal(restLength));
-
-                dirGeom.setLocalTranslation(location);
-                axleGeom.setLocalTranslation(location.addLocal(direction));
-                wheelGeom.setLocalTranslation(location);
-                i++;
-            }
-            debugShape.updateLogicalState(0);
-            debugShape.updateGeometricState();
-            rm.renderScene(debugShape, vp);
-        }
     }
 
     public void setPhysicsSpace(PhysicsSpace space) {

+ 0 - 118
engine/src/bullet/com/jme3/bullet/collision/PhysicsCollisionObject.java

@@ -31,20 +31,9 @@
  */
 package com.jme3.bullet.collision;
 
-import com.jme3.asset.AssetManager;
 import com.jme3.bullet.collision.shapes.CollisionShape;
-import com.jme3.bullet.util.DebugShapeFactory;
 import com.jme3.export.*;
-import com.jme3.material.Material;
-import com.jme3.math.ColorRGBA;
-import com.jme3.math.Vector3f;
-import com.jme3.scene.Geometry;
-import com.jme3.scene.Node;
-import com.jme3.scene.Spatial;
-import com.jme3.scene.debug.Arrow;
 import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -55,13 +44,6 @@ import java.util.logging.Logger;
 public abstract class PhysicsCollisionObject implements Savable {
 
     protected long objectId = 0;
-    protected Spatial debugShape;
-    protected Arrow debugArrow;
-    protected Geometry debugArrowGeom;
-    protected Material debugMaterialBlue;
-    protected Material debugMaterialRed;
-    protected Material debugMaterialGreen;
-    protected Material debugMaterialYellow;
     protected CollisionShape collisionShape;
     public static final int COLLISION_GROUP_NONE = 0x00000000;
     public static final int COLLISION_GROUP_01 = 0x00000001;
@@ -92,7 +74,6 @@ public abstract class PhysicsCollisionObject implements Savable {
      */
     public void setCollisionShape(CollisionShape collisionShape) {
         this.collisionShape = collisionShape;
-        updateDebugShape();
     }
 
     /**
@@ -174,103 +155,6 @@ public abstract class PhysicsCollisionObject implements Savable {
         initUserPointer(objectId, collisionGroup, collisionGroupsMask);
     }
     native void initUserPointer(long objectId, int group, int groups);
-    /**
-     * Creates a visual debug shape of the current collision shape of this physics object<br/>
-     * <b>Does not work with detached physics, please switch to PARALLEL or SEQUENTIAL for debugging</b>
-     * @param manager AssetManager to load the default wireframe material for the debug shape
-     */
-    protected Spatial attachDebugShape(AssetManager manager) {
-        debugMaterialBlue = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
-        debugMaterialBlue.getAdditionalRenderState().setWireframe(true);
-        debugMaterialBlue.setColor("Color", ColorRGBA.Blue);
-        debugMaterialGreen = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
-        debugMaterialGreen.getAdditionalRenderState().setWireframe(true);
-        debugMaterialGreen.setColor("Color", ColorRGBA.Green);
-        debugMaterialRed = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
-        debugMaterialRed.getAdditionalRenderState().setWireframe(true);
-        debugMaterialRed.setColor("Color", ColorRGBA.Red);
-        debugMaterialYellow = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
-        debugMaterialYellow.getAdditionalRenderState().setWireframe(true);
-        debugMaterialYellow.setColor("Color", ColorRGBA.Yellow);
-        debugArrow = new Arrow(Vector3f.UNIT_XYZ);
-        debugArrowGeom = new Geometry("DebugArrow", debugArrow);
-        debugArrowGeom.setMaterial(debugMaterialGreen);
-        return attachDebugShape();
-    }
-    
-    /**
-     * Creates a debug shape for this CollisionObject
-     * @param manager
-     * @return  The created debug shape
-     */
-    public Spatial createDebugShape(AssetManager manager){
-        return attachDebugShape(manager);
-    }
-
-    protected Spatial attachDebugShape(Material material) {
-        debugMaterialBlue = material;
-        debugMaterialGreen = material;
-        debugMaterialRed = material;
-        debugMaterialYellow = material;
-        debugArrow = new Arrow(Vector3f.UNIT_XYZ);
-        debugArrowGeom = new Geometry("DebugArrow", debugArrow);
-        debugArrowGeom.setMaterial(debugMaterialGreen);
-        return attachDebugShape();
-    }
-
-    public Spatial debugShape() {
-        return debugShape;
-    }
-
-    /**
-     * Creates a visual debug shape of the current collision shape of this physics object<br/>
-     * <b>Does not work with detached physics, please switch to PARALLEL or SEQUENTIAL for debugging</b>
-     * @param material Material to use for the debug shape
-     */
-    protected Spatial attachDebugShape() {
-        if (debugShape != null) {
-            detachDebugShape();
-        }
-        Spatial spatial = getDebugShape();
-        this.debugShape = spatial;
-        return debugShape;
-    }
-
-    protected void updateDebugShape() {
-        if (debugShape != null) {
-            detachDebugShape();
-            attachDebugShape();
-        }
-    }
-
-    protected Spatial getDebugShape() {
-        Spatial spatial = DebugShapeFactory.getDebugShape(collisionShape);
-        if (spatial == null) {
-            return new Node("nullnode");
-        }
-        if (spatial instanceof Node) {
-            List<Spatial> children = ((Node) spatial).getChildren();
-            for (Iterator<Spatial> it1 = children.iterator(); it1.hasNext();) {
-                Spatial spatial1 = it1.next();
-                Geometry geom = ((Geometry) spatial1);
-                geom.setMaterial(debugMaterialBlue);
-                geom.setCullHint(Spatial.CullHint.Never);
-            }
-        } else {
-            Geometry geom = ((Geometry) spatial);
-            geom.setMaterial(debugMaterialBlue);
-            geom.setCullHint(Spatial.CullHint.Never);
-        }
-        spatial.setCullHint(Spatial.CullHint.Never);
-        return spatial;
-    }
-
-    /**
-     * Removes the debug shape
-     */
-    public void detachDebugShape() {
-        debugShape = null;
-    }
 
     /**
      * @return the userObject
@@ -299,7 +183,6 @@ public abstract class PhysicsCollisionObject implements Savable {
         OutputCapsule capsule = e.getCapsule(this);
         capsule.write(collisionGroup, "collisionGroup", 0x00000001);
         capsule.write(collisionGroupsMask, "collisionGroupsMask", 0x00000001);
-        capsule.write(debugShape, "debugShape", null);
         capsule.write(collisionShape, "collisionShape", null);
     }
 
@@ -308,7 +191,6 @@ public abstract class PhysicsCollisionObject implements Savable {
         InputCapsule capsule = e.getCapsule(this);
         collisionGroup = capsule.readInt("collisionGroup", 0x00000001);
         collisionGroupsMask = capsule.readInt("collisionGroupsMask", 0x00000001);
-        debugShape = (Spatial) capsule.readSavable("debugShape", null);
         CollisionShape shape = (CollisionShape) capsule.readSavable("collisionShape", null);
         collisionShape = shape;
     }

+ 0 - 35
engine/src/bullet/com/jme3/bullet/objects/PhysicsRigidBody.java

@@ -44,13 +44,8 @@ import com.jme3.export.OutputCapsule;
 import com.jme3.math.Matrix3f;
 import com.jme3.math.Quaternion;
 import com.jme3.math.Vector3f;
-import com.jme3.scene.Geometry;
-import com.jme3.scene.Node;
-import com.jme3.scene.Spatial;
-import com.jme3.scene.debug.Arrow;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -650,7 +645,6 @@ public class PhysicsRigidBody extends PhysicsCollisionObject {
         if (!joints.contains(joint)) {
             joints.add(joint);
         }
-        updateDebugShape();
     }
 
     /**
@@ -669,35 +663,6 @@ public class PhysicsRigidBody extends PhysicsCollisionObject {
         return joints;
     }
 
-    @Override
-    protected Spatial getDebugShape() {
-        //add joints
-        Spatial shape = super.getDebugShape();
-        Node node = null;
-        if (shape instanceof Node) {
-            node = (Node) shape;
-        } else {
-            node = new Node("DebugShapeNode");
-            node.attachChild(shape);
-        }
-        int i = 0;
-        for (Iterator<PhysicsJoint> it = joints.iterator(); it.hasNext();) {
-            PhysicsJoint physicsJoint = it.next();
-            Vector3f pivot = null;
-            if (physicsJoint.getBodyA() == this) {
-                pivot = physicsJoint.getPivotA();
-            } else {
-                pivot = physicsJoint.getPivotB();
-            }
-            Arrow arrow = new Arrow(pivot);
-            Geometry geom = new Geometry("DebugBone" + i, arrow);
-            geom.setMaterial(debugMaterialGreen);
-            node.attachChild(geom);
-            i++;
-        }
-        return node;
-    }
-
     @Override
     public void write(JmeExporter e) throws IOException {
         super.write(e);

+ 0 - 50
engine/src/bullet/com/jme3/bullet/objects/PhysicsVehicle.java

@@ -39,13 +39,9 @@ import com.jme3.export.JmeExporter;
 import com.jme3.export.JmeImporter;
 import com.jme3.export.OutputCapsule;
 import com.jme3.math.Vector3f;
-import com.jme3.scene.Geometry;
-import com.jme3.scene.Node;
 import com.jme3.scene.Spatial;
-import com.jme3.scene.debug.Arrow;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -190,9 +186,6 @@ public class PhysicsVehicle extends PhysicsRigidBody {
         if (vehicleId != 0) {
             wheel.setVehicleId(vehicleId, addWheel(vehicleId, wheel.getLocation(), wheel.getDirection(), wheel.getAxle(), wheel.getRestLength(), wheel.getRadius(), tuning, wheel.isFrontWheel()));
         }
-        if (debugShape != null) {
-            updateDebugShape();
-        }
         return wheel;
     }
 
@@ -501,49 +494,6 @@ public class PhysicsVehicle extends PhysicsRigidBody {
         return vehicleId;
     }
 
-    @Override
-    protected Spatial getDebugShape() {
-        Spatial shape = super.getDebugShape();
-        Node node = null;
-        if (shape instanceof Node) {
-            node = (Node) shape;
-        } else {
-            node = new Node("DebugShapeNode");
-            node.attachChild(shape);
-        }
-        int i = 0;
-        for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) {
-            VehicleWheel physicsVehicleWheel = it.next();
-            Vector3f location = physicsVehicleWheel.getLocation().clone();
-            Vector3f direction = physicsVehicleWheel.getDirection().clone();
-            Vector3f axle = physicsVehicleWheel.getAxle().clone();
-            float restLength = physicsVehicleWheel.getRestLength();
-            float radius = physicsVehicleWheel.getRadius();
-
-            Arrow locArrow = new Arrow(location);
-            Arrow axleArrow = new Arrow(axle.normalizeLocal().multLocal(0.3f));
-            Arrow wheelArrow = new Arrow(direction.normalizeLocal().multLocal(radius));
-            Arrow dirArrow = new Arrow(direction.normalizeLocal().multLocal(restLength));
-            Geometry locGeom = new Geometry("WheelLocationDebugShape" + i, locArrow);
-            Geometry dirGeom = new Geometry("WheelDirectionDebugShape" + i, dirArrow);
-            Geometry axleGeom = new Geometry("WheelAxleDebugShape" + i, axleArrow);
-            Geometry wheelGeom = new Geometry("WheelRadiusDebugShape" + i, wheelArrow);
-            dirGeom.setLocalTranslation(location);
-            axleGeom.setLocalTranslation(location.add(direction));
-            wheelGeom.setLocalTranslation(location.add(direction));
-            locGeom.setMaterial(debugMaterialGreen);
-            dirGeom.setMaterial(debugMaterialGreen);
-            axleGeom.setMaterial(debugMaterialGreen);
-            wheelGeom.setMaterial(debugMaterialGreen);
-            node.attachChild(locGeom);
-            node.attachChild(dirGeom);
-            node.attachChild(axleGeom);
-            node.attachChild(wheelGeom);
-            i++;
-        }
-        return node;
-    }
-
     @Override
     public void read(JmeImporter im) throws IOException {
         InputCapsule capsule = im.getCapsule(this);

+ 0 - 119
engine/src/jbullet/com/jme3/bullet/collision/PhysicsCollisionObject.java

@@ -31,20 +31,9 @@
  */
 package com.jme3.bullet.collision;
 
-import com.jme3.asset.AssetManager;
 import com.jme3.bullet.collision.shapes.CollisionShape;
-import com.jme3.bullet.util.DebugShapeFactory;
 import com.jme3.export.*;
-import com.jme3.material.Material;
-import com.jme3.math.ColorRGBA;
-import com.jme3.math.Vector3f;
-import com.jme3.scene.Geometry;
-import com.jme3.scene.Node;
-import com.jme3.scene.Spatial;
-import com.jme3.scene.debug.Arrow;
 import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
 
 /**
  * Base class for collision objects (PhysicsRigidBody, PhysicsGhostObject)
@@ -52,13 +41,6 @@ import java.util.List;
  */
 public abstract class PhysicsCollisionObject implements Savable {
 
-    protected Spatial debugShape;
-    protected Arrow debugArrow;
-    protected Geometry debugArrowGeom;
-    protected Material debugMaterialBlue;
-    protected Material debugMaterialRed;
-    protected Material debugMaterialGreen;
-    protected Material debugMaterialYellow;
     protected CollisionShape collisionShape;
     public static final int COLLISION_GROUP_NONE = 0x00000000;
     public static final int COLLISION_GROUP_01 = 0x00000001;
@@ -89,7 +71,6 @@ public abstract class PhysicsCollisionObject implements Savable {
      */
     public void setCollisionShape(CollisionShape collisionShape) {
         this.collisionShape = collisionShape;
-        updateDebugShape();
     }
 
     /**
@@ -154,104 +135,6 @@ public abstract class PhysicsCollisionObject implements Savable {
         return collisionGroupsMask;
     }
 
-    /**
-     * Creates a visual debug shape of the current collision shape of this physics object<br/>
-     * <b>Does not work with detached physics, please switch to PARALLEL or SEQUENTIAL for debugging</b>
-     * @param manager AssetManager to load the default wireframe material for the debug shape
-     */
-    protected Spatial attachDebugShape(AssetManager manager) {
-        debugMaterialBlue = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
-        debugMaterialBlue.getAdditionalRenderState().setWireframe(true);
-        debugMaterialBlue.setColor("Color", ColorRGBA.Blue);
-        debugMaterialGreen = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
-        debugMaterialGreen.getAdditionalRenderState().setWireframe(true);
-        debugMaterialGreen.setColor("Color", ColorRGBA.Green);
-        debugMaterialRed = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
-        debugMaterialRed.getAdditionalRenderState().setWireframe(true);
-        debugMaterialRed.setColor("Color", ColorRGBA.Red);
-        debugMaterialYellow = new Material(manager, "Common/MatDefs/Misc/Unshaded.j3md");
-        debugMaterialYellow.getAdditionalRenderState().setWireframe(true);
-        debugMaterialYellow.setColor("Color", ColorRGBA.Yellow);
-        debugArrow = new Arrow(Vector3f.UNIT_XYZ);
-        debugArrowGeom = new Geometry("DebugArrow", debugArrow);
-        debugArrowGeom.setMaterial(debugMaterialGreen);
-        return attachDebugShape();
-    }
-    
-    /**
-     * creates a debug shape for this CollisionObject
-     * @param manager
-     * @return 
-     */
-    public Spatial createDebugShape(AssetManager manager){
-        return attachDebugShape(manager);
-    }
-
-    protected Spatial attachDebugShape(Material material) {
-        debugMaterialBlue = material;
-        debugMaterialGreen = material;
-        debugMaterialRed = material;
-        debugMaterialYellow = material;
-        debugArrow = new Arrow(Vector3f.UNIT_XYZ);
-        debugArrowGeom = new Geometry("DebugArrow", debugArrow);
-        debugArrowGeom.setMaterial(debugMaterialGreen);
-        return attachDebugShape();
-    }
-
-    public Spatial debugShape() {
-        return debugShape;
-    }
-
-    /**
-     * Creates a visual debug shape of the current collision shape of this physics object<br/>
-     * <b>Does not work with detached physics, please switch to PARALLEL or SEQUENTIAL for debugging</b>
-     * @param material Material to use for the debug shape
-     */
-    protected Spatial attachDebugShape() {
-        if (debugShape != null) {
-            detachDebugShape();
-        }
-        Spatial spatial = getDebugShape();
-        this.debugShape = spatial;
-        return debugShape;
-    }
-
-    protected void updateDebugShape() {
-        if (debugShape != null) {
-            detachDebugShape();
-            attachDebugShape();
-        }
-    }
-
-    protected Spatial getDebugShape() {
-        Spatial spatial = DebugShapeFactory.getDebugShape(collisionShape);
-        if (spatial == null) {
-            return new Node("nullnode");
-        }
-        if (spatial instanceof Node) {
-            List<Spatial> children = ((Node) spatial).getChildren();
-            for (Iterator<Spatial> it1 = children.iterator(); it1.hasNext();) {
-                Spatial spatial1 = it1.next();
-                Geometry geom = ((Geometry) spatial1);
-                geom.setMaterial(debugMaterialBlue);
-                geom.setCullHint(Spatial.CullHint.Never);
-            }
-        } else {
-            Geometry geom = ((Geometry) spatial);
-            geom.setMaterial(debugMaterialBlue);
-            geom.setCullHint(Spatial.CullHint.Never);
-        }
-        spatial.setCullHint(Spatial.CullHint.Never);
-        return spatial;
-    }
-
-    /**
-     * Removes the debug shape
-     */
-    public void detachDebugShape() {
-        debugShape = null;
-    }
-
     /**
      * @return the userObject
      */
@@ -271,7 +154,6 @@ public abstract class PhysicsCollisionObject implements Savable {
         OutputCapsule capsule = e.getCapsule(this);
         capsule.write(collisionGroup, "collisionGroup", 0x00000001);
         capsule.write(collisionGroupsMask, "collisionGroupsMask", 0x00000001);
-        capsule.write(debugShape, "debugShape", null);
         capsule.write(collisionShape, "collisionShape", null);
     }
 
@@ -280,7 +162,6 @@ public abstract class PhysicsCollisionObject implements Savable {
         InputCapsule capsule = e.getCapsule(this);
         collisionGroup = capsule.readInt("collisionGroup", 0x00000001);
         collisionGroupsMask = capsule.readInt("collisionGroupsMask", 0x00000001);
-        debugShape = (Spatial) capsule.readSavable("debugShape", null);
         CollisionShape shape = (CollisionShape) capsule.readSavable("collisionShape", null);
         collisionShape = shape;
     }

+ 0 - 35
engine/src/jbullet/com/jme3/bullet/objects/PhysicsRigidBody.java

@@ -49,13 +49,8 @@ import com.jme3.export.OutputCapsule;
 import com.jme3.math.Matrix3f;
 import com.jme3.math.Quaternion;
 import com.jme3.math.Vector3f;
-import com.jme3.scene.Geometry;
-import com.jme3.scene.Node;
-import com.jme3.scene.Spatial;
-import com.jme3.scene.debug.Arrow;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -587,7 +582,6 @@ public class PhysicsRigidBody extends PhysicsCollisionObject {
         if (!joints.contains(joint)) {
             joints.add(joint);
         }
-        updateDebugShape();
     }
 
     /**
@@ -620,35 +614,6 @@ public class PhysicsRigidBody extends PhysicsCollisionObject {
         rBody.destroy();
     }
 
-    @Override
-    protected Spatial getDebugShape() {
-        //add joints
-        Spatial shape = super.getDebugShape();
-        Node node = null;
-        if (shape instanceof Node) {
-            node = (Node) shape;
-        } else {
-            node = new Node("DebugShapeNode");
-            node.attachChild(shape);
-        }
-        int i = 0;
-        for (Iterator<PhysicsJoint> it = joints.iterator(); it.hasNext();) {
-            PhysicsJoint physicsJoint = it.next();
-            Vector3f pivot = null;
-            if (physicsJoint.getBodyA() == this) {
-                pivot = physicsJoint.getPivotA();
-            } else {
-                pivot = physicsJoint.getPivotB();
-            }
-            Arrow arrow = new Arrow(pivot);
-            Geometry geom = new Geometry("DebugBone" + i, arrow);
-            geom.setMaterial(debugMaterialGreen);
-            node.attachChild(geom);
-            i++;
-        }
-        return node;
-    }
-
     @Override
     public void write(JmeExporter e) throws IOException {
         super.write(e);

+ 0 - 48
engine/src/jbullet/com/jme3/bullet/objects/PhysicsVehicle.java

@@ -179,10 +179,6 @@ public class PhysicsVehicle extends PhysicsRigidBody {
         wheel.setWheelsDampingRelaxation(tuning.suspensionDamping);
         wheel.setMaxSuspensionForce(tuning.maxSuspensionForce);
         wheels.add(wheel);
-        if (debugShape != null) {
-            detachDebugShape();
-        }
-//        updateDebugShape();
         return wheel;
     }
 
@@ -193,7 +189,6 @@ public class PhysicsVehicle extends PhysicsRigidBody {
     public void removeWheel(int wheel) {
         wheels.remove(wheel);
         rebuildRigidBody();
-//        updateDebugShape();
     }
 
     /**
@@ -485,49 +480,6 @@ public class PhysicsVehicle extends PhysicsRigidBody {
         super.destroy();
     }
 
-    @Override
-    protected Spatial getDebugShape() {
-        Spatial shape = super.getDebugShape();
-        Node node = null;
-        if (shape instanceof Node) {
-            node = (Node) shape;
-        } else {
-            node = new Node("DebugShapeNode");
-            node.attachChild(shape);
-        }
-        int i = 0;
-        for (Iterator<VehicleWheel> it = wheels.iterator(); it.hasNext();) {
-            VehicleWheel physicsVehicleWheel = it.next();
-            Vector3f location = physicsVehicleWheel.getLocation().clone();
-            Vector3f direction = physicsVehicleWheel.getDirection().clone();
-            Vector3f axle = physicsVehicleWheel.getAxle().clone();
-            float restLength = physicsVehicleWheel.getRestLength();
-            float radius = physicsVehicleWheel.getRadius();
-
-            Arrow locArrow = new Arrow(location);
-            Arrow axleArrow = new Arrow(axle.normalizeLocal().multLocal(0.3f));
-            Arrow wheelArrow = new Arrow(direction.normalizeLocal().multLocal(radius));
-            Arrow dirArrow = new Arrow(direction.normalizeLocal().multLocal(restLength));
-            Geometry locGeom = new Geometry("WheelLocationDebugShape" + i, locArrow);
-            Geometry dirGeom = new Geometry("WheelDirectionDebugShape" + i, dirArrow);
-            Geometry axleGeom = new Geometry("WheelAxleDebugShape" + i, axleArrow);
-            Geometry wheelGeom = new Geometry("WheelRadiusDebugShape" + i, wheelArrow);
-            dirGeom.setLocalTranslation(location);
-            axleGeom.setLocalTranslation(location.add(direction));
-            wheelGeom.setLocalTranslation(location.add(direction));
-            locGeom.setMaterial(debugMaterialGreen);
-            dirGeom.setMaterial(debugMaterialGreen);
-            axleGeom.setMaterial(debugMaterialGreen);
-            wheelGeom.setMaterial(debugMaterialGreen);
-            node.attachChild(locGeom);
-            node.attachChild(dirGeom);
-            node.attachChild(axleGeom);
-            node.attachChild(wheelGeom);
-            i++;
-        }
-        return node;
-    }
-
     @Override
     public void read(JmeImporter im) throws IOException {
         InputCapsule capsule = im.getCapsule(this);