From ce4cfb6670eaba20e27f8c5f499980be59bf0853 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 15 Mar 2011 22:16:17 +0000 Subject: Added blimp model Remove gravity for the blimp in World line 224 --- src/tesseract/objects/blimp/BlimpBox.java | 81 +++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 src/tesseract/objects/blimp/BlimpBox.java (limited to 'src/tesseract/objects/blimp/BlimpBox.java') diff --git a/src/tesseract/objects/blimp/BlimpBox.java b/src/tesseract/objects/blimp/BlimpBox.java new file mode 100644 index 0000000..6d75777 --- /dev/null +++ b/src/tesseract/objects/blimp/BlimpBox.java @@ -0,0 +1,81 @@ +package tesseract.objects.blimp; + +import java.awt.Color; + +import javax.media.j3d.Appearance; +import javax.media.j3d.Geometry; +import javax.media.j3d.Material; +import javax.media.j3d.Node; +import javax.media.j3d.TransformGroup; +import javax.vecmath.Color3f; +import javax.vecmath.Vector3f; + +import tesseract.objects.PhysicalObject; + +import com.sun.j3d.utils.geometry.Box; +import com.sun.j3d.utils.geometry.Primitive; + +public class BlimpBox extends PhysicalObject { + + /** + * The appearance of this blimp box + */ + private Appearance my_appearance; + + /** + * The width. + */ + private float my_width; + + /** + * The height. + */ + private float my_height; + + /** + * The depth. + */ + private float my_depth; + + /** + * The tg for this object + */ + private TransformGroup my_tg; + + + + public BlimpBox(float mass, float width, float height, float depth, + Vector3f position, final Appearance app) { + super(position, mass); + + my_width = width; + my_height = height; + my_depth = depth; + my_appearance = app; + + + setShape(createShape()); + + previousPosition.set(position); + if (inverseMass != 0) { + inverseInertiaTensor.m00 = 1f / 12 / inverseMass * (height * height + depth * depth); + inverseInertiaTensor.m11 = 1f / 12 / inverseMass * (width * width + depth * depth); + inverseInertiaTensor.m22 = 1f / 12 / inverseMass * (width * width + height * height); + inverseInertiaTensor.invert(); + } + updateTransformGroup(); + } + + public Node createShape() { + return new com.sun.j3d.utils.geometry.Box(my_width / 2, my_height / 2, my_depth / 2, my_appearance); + + } + + /** + * get the tg for this box + */ + public Node getTG() { + return my_tg; + } +} + -- cgit v1.2.3