summaryrefslogtreecommitdiff
path: root/src/tesseract/objects/tank/Body.java
diff options
context:
space:
mode:
authorPhillip <pacardon@u.washington.edu>2011-03-15 20:43:02 +0000
committerPhillip <pacardon@u.washington.edu>2011-03-15 20:43:02 +0000
commite6538f3f532fdcd35d0c97c2bc45caa1c7af0f35 (patch)
tree5ac904bff5bbe8736b43c25085d1362f834a4dcf /src/tesseract/objects/tank/Body.java
parent76d368d064273090cd28556cc1d59562e468bb6a (diff)
Tank now moves and turns appropriately. As well as fires semi-appropriately.
Diffstat (limited to 'src/tesseract/objects/tank/Body.java')
-rw-r--r--src/tesseract/objects/tank/Body.java26
1 files changed, 9 insertions, 17 deletions
diff --git a/src/tesseract/objects/tank/Body.java b/src/tesseract/objects/tank/Body.java
index 9370f1d..ec9b33a 100644
--- a/src/tesseract/objects/tank/Body.java
+++ b/src/tesseract/objects/tank/Body.java
@@ -61,7 +61,7 @@ public class Body {
appearance.setMaterial(material);
Primitive box = new Box(width * theScale, height * theScale,
depth * theScale, appearance);
- Shape3D front = box.getShape(Box.FRONT);
+ Shape3D front = box.getShape(Box.RIGHT);
//
Geometry g = front.getGeometry(0);
GeometryInfo gi = new GeometryInfo((GeometryArray)g);
@@ -96,34 +96,26 @@ public class Body {
material.setDiffuseColor(new Color3f(turretColor));
appearance.setColoringAttributes(new ColoringAttributes(new Color3f(turretColor), ColoringAttributes.NICEST));
appearance.setMaterial(material);
- TransformGroup tg = new TransformGroup();
- TransformGroup gunTG = new TransformGroup();
+
+
Primitive sphere = new Sphere(radius * theScale, appearance);
Primitive gun = new Cylinder(gunRad * theScale, gunLength * theScale, appearance);
+
+
+ TransformGroup tg = new TransformGroup();
+ TransformGroup gunTG = new TransformGroup();
gunTG.addChild(gun);
Transform3D mg = new Transform3D();
mg.rotZ(Math.PI / 2);
mg.setTranslation(new Vector3f(1.4f * theScale, .25f * theScale, 0));
- //shooter.moveMe(new Vector3f(1.4f * theScale, .25f * theScale, 0));
gunTG.setTransform(mg);
- Transform3D rotateGun = new Transform3D();
- rotateGun.rotY(Math.PI / 2);
- //toMove.mul(rotateGun);
+
+
tg.addChild(sphere);
tg.addChild(barrel);
barrel.addChild(gunTG);
tg.setTransform(toMove);
turret.addChild(tg);
- //Node s = barrel.getChild(Cylinder.BOTTOM);
- //if (s instanceof Shape3D) {
- //Shape3D r = (Shape3D) s;
- //Geometry g = r.getGeometry(0);
- //GeometryInfo gi = new GeometryInfo((GeometryArray)g);
- //aim = (gi.getNormals())[0];
- //}
- //turret.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
- //turret.setTransform(rotateGun);
- //tg.setTransform();
}
public TransformGroup getBody() {