summaryrefslogtreecommitdiff
path: root/src/tesseract/objects
diff options
context:
space:
mode:
authorPhillip <pacardon@u.washington.edu>2011-03-11 02:01:05 +0000
committerPhillip <pacardon@u.washington.edu>2011-03-11 02:01:05 +0000
commit19007d3f4a1c69777cb01d50e433fb971519a1d2 (patch)
tree3ba847b15cee8bb0aa4750811b13f70f7d8f1c47 /src/tesseract/objects
parentd388e0542c246bbb462ffacb2245205b258b1324 (diff)
Diffstat (limited to 'src/tesseract/objects')
-rw-r--r--src/tesseract/objects/tank/Body.java34
1 files changed, 22 insertions, 12 deletions
diff --git a/src/tesseract/objects/tank/Body.java b/src/tesseract/objects/tank/Body.java
index c07b112..f143ec5 100644
--- a/src/tesseract/objects/tank/Body.java
+++ b/src/tesseract/objects/tank/Body.java
@@ -18,12 +18,12 @@ import com.sun.j3d.utils.geometry.Primitive;
import com.sun.j3d.utils.geometry.Sphere;
public class Body {
- private static final float width = 1.35f;
- private static final float height = .45f;
- private static final float depth = .9f;
- private static float radius = .75f;
- private static float gunRad = .075f;
- private static float gunLength = 2f;
+ public static final float width = 1.35f;
+ public static final float height = .45f;
+ public static final float depth = .9f;
+ public static float radius = .75f;
+ public static float gunRad = .075f;
+ public static float gunLength = 2f;
public static TransformGroup makeBody(Color trackColor, Color bodyColor, float theScale) {
TransformGroup tank = new TransformGroup();
@@ -56,22 +56,32 @@ public class Body {
//TransformGroup[] tankNturret = {tank, turret};
return tank;
}
- public static TransformGroup makeTurret(Appearance theApperance,
+ public static TransformGroup makeTurret(Color turretColor,
float theScale, Transform3D toMove) {
-
+ Appearance appearance = new Appearance();
+ Material material = new Material();
+ 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, theApperance);
- Primitive gun = new Cylinder(gunRad * theScale,
- gunLength * theScale, theApperance);
+ Primitive sphere = new Sphere(radius * theScale, appearance);
+ Primitive gun = new Cylinder(gunRad * theScale, gunLength * theScale, appearance);
gunTG.addChild(gun);
Transform3D mg = new Transform3D();
mg.rotZ(Math.PI / 2);
mg.setTranslation(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(gunTG);
tg.setTransform(toMove);
- return tg;
+ TransformGroup turret = new TransformGroup();
+ turret.addChild(tg);
+ turret.setTransform(rotateGun);
+ //tg.setTransform();
+ return turret;
}
}