diff options
Diffstat (limited to 'src/tesseract/objects')
-rw-r--r-- | src/tesseract/objects/Icosahedron.java | 9 | ||||
-rw-r--r-- | src/tesseract/objects/PhysicalObject.java | 8 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/tesseract/objects/Icosahedron.java b/src/tesseract/objects/Icosahedron.java index 668295c..eb2efa0 100644 --- a/src/tesseract/objects/Icosahedron.java +++ b/src/tesseract/objects/Icosahedron.java @@ -61,7 +61,14 @@ public class Icosahedron extends PhysicalObject { super(position, mass);
setShape(buildIcosahedron(scale));
- //this.centerOfMass = new Vector3f(0.01f, 0.01f, 0.01f);
+
+ if (inverseMass != 0) {
+ final float radius = (float) (scale * Math.sqrt(GOLDEN_RATIO * GOLDEN_RATIO + 1));
+ inverseInertiaTensor.m00 = 2f / 5 / inverseMass * radius * radius;
+ inverseInertiaTensor.m11 = inverseInertiaTensor.m00;
+ inverseInertiaTensor.m22 = inverseInertiaTensor.m00;
+ inverseInertiaTensor.invert();
+ }
}
/**
diff --git a/src/tesseract/objects/PhysicalObject.java b/src/tesseract/objects/PhysicalObject.java index 01fc5f7..fa69e8a 100644 --- a/src/tesseract/objects/PhysicalObject.java +++ b/src/tesseract/objects/PhysicalObject.java @@ -6,6 +6,7 @@ import javax.media.j3d.GeometryArray; import javax.media.j3d.Node; import javax.media.j3d.Shape3D; import javax.media.j3d.TransformGroup; +import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; import alden.CollidableObject; @@ -99,6 +100,13 @@ public class PhysicalObject extends CollidableObject { public Vector3f getPosition() { return position; } + + /** + * @return The orientation of the object. + */ + public Quat4f getOrientation() { + return this.orientation; + } /** * When set to true, the object will ignore all updateState calls. |