/** * Instantiate an enabled control to visualize the specified character. * * @param debugAppState which app state (not null, alias created) * @param body the character to visualize (not null, alias created) */ public BulletCharacterDebugControl(BulletDebugAppState debugAppState, PhysicsCharacter body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_PINK); }
/** * Instantiate an enabled control to visualize the specified character. * * @param debugAppState which app state (not null, alias created) * @param body the character to visualize (not null, alias created) */ public BulletCharacterDebugControl(BulletDebugAppState debugAppState, PhysicsCharacter body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_PINK); }
/** * Instantiate an enabled control to visualize the specified ghost object. * * @param debugAppState which app state (not null, alias created) * @param body which object to visualize (not null, alias created) */ public BulletGhostObjectDebugControl(BulletDebugAppState debugAppState, PhysicsGhostObject body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_YELLOW); }
/** * Instantiate an enabled control to visualize the specified body. * * @param debugAppState which app state (not null, alias created) * @param body which body to visualize (not null, alias created) */ public BulletRigidBodyDebugControl(BulletDebugAppState debugAppState, PhysicsRigidBody body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_BLUE); }
/** * Instantiate an enabled control to visualize the specified ghost object. * * @param debugAppState which app state (not null, alias created) * @param body which object to visualize (not null, alias created) */ public BulletGhostObjectDebugControl(BulletDebugAppState debugAppState, PhysicsGhostObject body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_YELLOW); }
/** * Instantiate an enabled control to visualize the specified body. * * @param debugAppState which app state (not null, alias created) * @param body which body to visualize (not null, alias created) */ public BulletRigidBodyDebugControl(BulletDebugAppState debugAppState, PhysicsRigidBody body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_BLUE); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } geom.setMaterial(debugAppState.DEBUG_PINK); body.getPhysicsLocation(location); applyPhysicsTransform(location, Quaternion.IDENTITY); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } geom.setMaterial(debugAppState.DEBUG_PINK); body.getPhysicsLocation(location); applyPhysicsTransform(location, Quaternion.IDENTITY); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } geom.setMaterial(debugAppState.DEBUG_YELLOW); body.getPhysicsLocation(location); body.getPhysicsRotation(rotation); applyPhysicsTransform(location, rotation); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } geom.setMaterial(debugAppState.DEBUG_YELLOW); body.getPhysicsLocation(location); body.getPhysicsRotation(rotation); applyPhysicsTransform(location, rotation); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } if(body.isActive()){ geom.setMaterial(debugAppState.DEBUG_MAGENTA); }else{ geom.setMaterial(debugAppState.DEBUG_BLUE); } body.getPhysicsLocation(location); body.getPhysicsRotation(rotation); applyPhysicsTransform(location, rotation); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } if(body.isActive()){ geom.setMaterial(debugAppState.DEBUG_MAGENTA); }else{ geom.setMaterial(debugAppState.DEBUG_BLUE); } body.getPhysicsLocation(location); body.getPhysicsRotation(rotation); applyPhysicsTransform(location, rotation); }
/** * Instantiate an enabled control to visualize the specified body. * * @param debugAppState which app state (not null, alias created) * @param body which body to visualize (not null, alias created) */ public BulletRigidBodyDebugControl(BulletDebugAppState debugAppState, PhysicsRigidBody body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_BLUE); }
/** * Instantiate an enabled control to visualize the specified ghost object. * * @param debugAppState which app state (not null, alias created) * @param body which object to visualize (not null, alias created) */ public BulletGhostObjectDebugControl(BulletDebugAppState debugAppState, PhysicsGhostObject body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_YELLOW); }
/** * Instantiate an enabled control to visualize the specified character. * * @param debugAppState which app state (not null, alias created) * @param body the character to visualize (not null, alias created) */ public BulletCharacterDebugControl(BulletDebugAppState debugAppState, PhysicsCharacter body) { super(debugAppState); this.body = body; myShape = body.getCollisionShape(); oldScale.set(myShape.getScale()); this.geom = DebugShapeFactory.getDebugShape(myShape); this.geom.setName(body.toString()); geom.setMaterial(debugAppState.DEBUG_PINK); }
@Override protected void controlUpdate(float tpf) { if(myShape != body.getCollisionShape()){ Node node = (Node) this.spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(body.getCollisionShape()); geom.setMaterial(debugAppState.DEBUG_PINK); node.attachChild(geom); } applyPhysicsTransform(body.getPhysicsLocation(location), Quaternion.IDENTITY); geom.setLocalScale(body.getCollisionShape().getScale()); }
@Override protected void controlUpdate(float tpf) { if (myShape != body.getCollisionShape()) { Node node = (Node) this.spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(body.getCollisionShape()); geom.setMaterial(debugAppState.DEBUG_YELLOW); node.attachChild(geom); } applyPhysicsTransform(body.getPhysicsLocation(location), body.getPhysicsRotation(rotation)); geom.setLocalScale(body.getCollisionShape().getScale()); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } if(body.isActive()){ geom.setMaterial(debugAppState.DEBUG_MAGENTA); }else{ geom.setMaterial(debugAppState.DEBUG_BLUE); } body.getPhysicsLocation(location); body.getPhysicsRotation(rotation); applyPhysicsTransform(location, rotation); }
public static Mesh getDebugMesh(CollisionShape shape) { Mesh mesh = new Mesh(); DebugMeshCallback callback = new DebugMeshCallback(); /* * Populate the mesh based on an unscaled shape; * the shape's scale will be applied later, to the geometry. */ Vector3f savedScale = shape.getScale().clone(); shape.setScale(Vector3f.UNIT_XYZ); getVertices(shape.getObjectId(), callback); shape.setScale(savedScale); mesh.setBuffer(Type.Position, 3, callback.getVertices()); mesh.getFloatBuffer(Type.Position).clear(); return mesh; }
@Override protected void controlUpdate(float tpf) { if(myShape != body.getCollisionShape()){ Node node = (Node) this.spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(body.getCollisionShape()); node.attachChild(geom); } if(body.isActive()){ geom.setMaterial(debugAppState.DEBUG_MAGENTA); }else{ geom.setMaterial(debugAppState.DEBUG_BLUE); } applyPhysicsTransform(body.getPhysicsLocation(location), body.getPhysicsRotation(rotation)); geom.setLocalScale(body.getCollisionShape().getScale()); }