use of com.jme3.bullet.objects.PhysicsRigidBody in project jmonkeyengine by jMonkeyEngine.
the class BombControl method physicsTick.
public void physicsTick(PhysicsSpace space, float f) {
//get all overlapping objects and apply impulse to them
for (Iterator<PhysicsCollisionObject> it = ghostObject.getOverlappingObjects().iterator(); it.hasNext(); ) {
PhysicsCollisionObject physicsCollisionObject = it.next();
if (physicsCollisionObject instanceof PhysicsRigidBody) {
PhysicsRigidBody rBody = (PhysicsRigidBody) physicsCollisionObject;
rBody.getPhysicsLocation(vector2);
vector2.subtractLocal(vector);
float force = explosionRadius - vector2.length();
force *= forceFactor;
force = force > 0 ? force : 0;
vector2.normalizeLocal();
vector2.multLocal(force);
((PhysicsRigidBody) physicsCollisionObject).applyImpulse(vector2, Vector3f.ZERO);
}
}
space.removeTickListener(this);
space.remove(ghostObject);
}
use of com.jme3.bullet.objects.PhysicsRigidBody in project jmonkeyengine by jMonkeyEngine.
the class PhysicsJoint method read.
public void read(JmeImporter im) throws IOException {
InputCapsule capsule = im.getCapsule(this);
this.nodeA = ((PhysicsRigidBody) capsule.readSavable("nodeA", new PhysicsRigidBody()));
this.nodeB = (PhysicsRigidBody) capsule.readSavable("nodeB", new PhysicsRigidBody());
this.pivotA = (Vector3f) capsule.readSavable("pivotA", new Vector3f());
this.pivotB = (Vector3f) capsule.readSavable("pivotB", new Vector3f());
}
Aggregations