public void removeCollisionObject(PhysicsCollisionObject obj) { if (obj instanceof PhysicsGhostObject) { removeGhostObject((PhysicsGhostObject) obj); } else if (obj instanceof PhysicsRigidBody) { removeRigidBody((PhysicsRigidBody) obj); } else if (obj instanceof PhysicsCharacter) { removeCharacter((PhysicsCharacter) obj); } }
/** * Initialize this state prior to its 1st update. Should be invoked only by * a subclass or by the AppStateManager. * * @param stateManager the manager for this state (not null) * @param app the application which owns this state (not null) */ public void initialize(AppStateManager stateManager, Application app) { this.app = app; this.stateManager = stateManager; startPhysics(); }
public void tileDetached(Vector3f cell, TerrainQuad quad) { if (quad.getControl(RigidBodyControl.class) != null) { bulletAppState.getPhysicsSpace().remove(quad); quad.removeControl(RigidBodyControl.class); } }
public void addCollisionObject(PhysicsCollisionObject obj) { if (obj instanceof PhysicsGhostObject) { addGhostObject((PhysicsGhostObject) obj); } else if (obj instanceof PhysicsRigidBody) { addRigidBody((PhysicsRigidBody) obj); } else if (obj instanceof PhysicsVehicle) { addRigidBody((PhysicsVehicle) obj); } else if (obj instanceof PhysicsCharacter) { addCharacter((PhysicsCharacter) obj); } }
private PhysicsSpace getPhysicsSpace() { return bulletAppState.getPhysicsSpace(); } }
/** * Remove all managed physics objects from the specified space. * * @param space which physics space to remove from (not null) */ @Override protected void removePhysics(PhysicsSpace space) { space.removeCollisionObject(rigidBody); space.removeTickListener(this); }
/** * Update this space. Invoked (by the Bullet app state) once per frame while * the app state is attached and enabled. * * @param time time-per-frame multiplied by speed (in seconds, ≥0) */ public void update(float time) { update(time, maxSubSteps); }
private void cleanupData() { physicsState.stopPhysics(); //TODO: remove all objects? physicsState = null; rootNode = null; }
/** * Alter the number of iterations used by the contact-and-constraint solver. * <p> * Use 4 for low quality, 20 for high quality. * * @param numIterations the desired number of iterations (≥1, default=10) */ public void setSolverNumIterations(int numIterations) { this.solverNumIterations = numIterations; setSolverNumIterations(physicsSpaceId, numIterations); }
public void tileDetached(Vector3f cell, TerrainQuad quad) { if (usePhysics) { if (quad.getControl(RigidBodyControl.class) != null) { bulletAppState.getPhysicsSpace().remove(quad); quad.removeControl(RigidBodyControl.class); } } updateMarkerElevations(); } });
private PhysicsSpace getPhysicsSpace() { return bulletAppState.getPhysicsSpace(); } }
/** * Remove all managed physics objects from the specified space. * * @param space which physics space to remove from (not null) */ @Override protected void removePhysics(PhysicsSpace space) { space.removeCollisionObject(rigidBody); space.removeTickListener(this); }
/** * Initialize this state prior to its 1st update. Should be invoked only by * a subclass or by the AppStateManager. * * @param stateManager the manager for this state (not null) * @param app the application which owns this state (not null) */ public void initialize(AppStateManager stateManager, Application app) { this.app = app; this.stateManager = stateManager; startPhysics(); }
/** * updates the physics space * @param time the current time value */ public void update(float time) { update(time, maxSubSteps); }
public void tileDetached(Vector3f cell, TerrainQuad quad) { if (quad.getControl(RigidBodyControl.class) != null) { bulletAppState.getPhysicsSpace().remove(quad); quad.removeControl(RigidBodyControl.class); } }
private PhysicsSpace getPhysicsSpace() { return bulletAppState.getPhysicsSpace(); } private ActionListener actionListener = new ActionListener() {
public void tileDetached(Vector3f cell, TerrainQuad quad) { if (quad.getControl(RigidBodyControl.class) != null) { bulletAppState.getPhysicsSpace().remove(quad); quad.removeControl(RigidBodyControl.class); } }
private PhysicsSpace getPhysicsSpace() { return bulletAppState.getPhysicsSpace(); } private ActionListener actionListener = new ActionListener() {