From 354041e8d61571b25c6eeb672537a013d3e0fa60 Mon Sep 17 00:00:00 2001 From: Jesse Morgan Date: Fri, 11 Feb 2011 18:53:32 +0000 Subject: Broke the grabbing code but added Alden's collision code. Not sure if its working yet since my Mac doesn't like it. --- src/tesseract/objects/ForceableObject.java | 90 ------------------------------ 1 file changed, 90 deletions(-) delete mode 100644 src/tesseract/objects/ForceableObject.java (limited to 'src/tesseract/objects/ForceableObject.java') diff --git a/src/tesseract/objects/ForceableObject.java b/src/tesseract/objects/ForceableObject.java deleted file mode 100644 index b918452..0000000 --- a/src/tesseract/objects/ForceableObject.java +++ /dev/null @@ -1,90 +0,0 @@ -package tesseract.objects; - -import java.util.List; - -import javax.vecmath.Vector3f; - -/** - * This class is the an abstract parent class for forceable objects. - * - * @author Jesse Morgan - */ -public abstract class ForceableObject - extends PhysicalObject implements Forceable { - /** - * The inverse of the object's mass. - */ - protected float myInverseMass; - - /** - * Object's velocity. - */ - private Vector3f myVelocity; - - /** - * Sum of all the forces affecting this object. - */ - private Vector3f myForces; - - /** - * Construct a new ForceableObject. - * - * @param position Initial Position. - * @param mass Initial Mass. - */ - public ForceableObject(final Vector3f position, final float mass) { - super(position); - - myInverseMass = 1 / mass; - myVelocity = new Vector3f(0, 0, 0); - myForces = new Vector3f(0, 0, 0); - } - - /** - * @return The inverse mass of the object. - */ - public float getInverseMass() { - return myInverseMass; - } - - /** - * @return Get the velocity of the object. - */ - public Vector3f getVelocity() { - return myVelocity; - } - - /** - * Apply a new force to this object. - * @param force The force to apply. - */ - public void addForce(final Vector3f force) { - myForces.add(force); - } - - /** - * Update the state of the forceable object. - * - * @param duration The length of time that has passed. - * @return A list of new objects to add to the world. - */ - public List updateState(final float duration) { - List children = super.updateState(duration); - - // The force vector now becomes the acceleration vector. - myForces.scale(myInverseMass); - myPosition.scaleAdd(duration, myVelocity, myPosition); - myPosition.scaleAdd(duration * duration / 2, myForces, myPosition); - myVelocity.scaleAdd(duration, myForces, myVelocity); - - // The force vector is cleared. - myForces.x = 0; - myForces.y = 0; - myForces.z = 0; - - updateTransformGroup(); - - return children; - } - -} -- cgit v1.2.3