summaryrefslogtreecommitdiff
path: root/src/tesseract/forces/Force.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/tesseract/forces/Force.java')
-rw-r--r--src/tesseract/forces/Force.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/tesseract/forces/Force.java b/src/tesseract/forces/Force.java
new file mode 100644
index 0000000..60498a1
--- /dev/null
+++ b/src/tesseract/forces/Force.java
@@ -0,0 +1,29 @@
+package tesseract.forces;
+
+import javax.vecmath.Vector3f;
+
+import tesseract.objects.Forceable;
+
+/**
+ * Abstract Force class.
+ *
+ * @author Jesse Morgan
+ */
+public abstract class Force {
+
+ /**
+ * Calculate the force to apply to the give object.
+ * @param obj The given object.
+ * @return A vector describing the force.
+ */
+ protected abstract Vector3f calculateForce(final Forceable obj);
+
+ /**
+ * Apply this force to the given object.
+ *
+ * @param obj The given object.
+ */
+ public void applyForceTo(final Forceable obj) {
+ obj.addForce(calculateForce(obj));
+ }
+}