summaryrefslogtreecommitdiff
path: root/src/tesseract/forces/Force.java
blob: 60498a13aa8346e006a2122797d3470c0df66bf1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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));
	}
}