blob: 360167695311e5a999916772d5a2aaa554d23807 (
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 CircularXZ extends Force {
private float strength;
public CircularXZ(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";
}
}
|