blob: 746064a13e808a77c484dc77bf269f2942ab6e6f (
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
|
package tesseract.forces;
import javax.vecmath.Vector3f;
import tesseract.objects.PhysicalObject;
@SuppressWarnings("restriction")
public class Circular extends Force {
private float strength;
public Circular(float strength) {
this.strength = strength;
}
public Vector3f calculateForce(final PhysicalObject obj) {
Vector3f force = new Vector3f(-obj.getPosition().z, 0, obj.getPosition().x);
if (force.length() > 0) {
force.normalize();
force.scale(strength);
}
return force;
}
public String toString() {
return "Tangential force in the XZ plane";
}
}
|