summaryrefslogtreecommitdiff
path: root/src/tesseract/objects/tank/Tank.java
diff options
context:
space:
mode:
authorPhillip <pacardon@u.washington.edu>2011-03-16 05:23:02 +0000
committerPhillip <pacardon@u.washington.edu>2011-03-16 05:23:02 +0000
commite3f6a4acb207064a1bc3fa87cb393bdfdd5acd62 (patch)
tree976a830be2d1b2103aa08bff0ca05a1827250a62 /src/tesseract/objects/tank/Tank.java
parentda7f3615f6a63a9ef6422a80de048c58d77e19a6 (diff)
As per the size of the blimp I saw, I reduced the scale of the tank to keep a balance. Tank has been reduced by 1/4 of its original scaled size (0.625 to 0.625 / 4). Due to the scaling (and Java3D's horrid rendering) I have disabled antialising in TesseractUI to make the tank rendering. Also added maximum tank speed (0.3f vector length) and enforced it.
Diffstat (limited to 'src/tesseract/objects/tank/Tank.java')
-rw-r--r--src/tesseract/objects/tank/Tank.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/tesseract/objects/tank/Tank.java b/src/tesseract/objects/tank/Tank.java
index f702c96..97ee5ea 100644
--- a/src/tesseract/objects/tank/Tank.java
+++ b/src/tesseract/objects/tank/Tank.java
@@ -24,7 +24,7 @@ public class Tank extends RemoteObject {
KeyEvent lastEvent;
//private Vector3f aim;
//private final Point3f gunLocation;
- private static final float DEFAULT_SCALE = 0.0625f;
+ private static final float DEFAULT_SCALE = 0.0625f / 4f;
private static final Color DEFAULT_BODY_COLOR = Color.GREEN;
private static final Color DEFAULT_TRACK_COLOR = Color.DARK_GRAY;
private static final Color DEFAULT_TURRET_COLOR = Color.GREEN;
@@ -35,6 +35,7 @@ public class Tank extends RemoteObject {
private final float myScale;
private int barrelTurn = 0;
private final int MAX_TURN = 32;
+ private final float MAX_SPEED = .3f;
public Tank(final Vector3f thePosition, final float mass) {
this(thePosition, mass, DEFAULT_SCALE);
@@ -239,9 +240,10 @@ public class Tank extends RemoteObject {
collector.mul(pGun);
Vector3f accelerator = new Vector3f();
collector.get(accelerator);
+
//System.out.println(accelerator);
ModifyableParticle toAdd = new ModifyableParticle(position, 1f, new Color3f(Color.RED),
- particleBody, particleGunTG);
+ particleBody, particleGunTG, myScale);
toAdd.setAcceleration(accelerator);
/*
float xyTheta = ((float) Math.PI / 32) * barrelElevation;
@@ -301,6 +303,20 @@ public class Tank extends RemoteObject {
return children;
}
+ public void updateState(float duration) {
+ float speed = velocity.length();
+ //System.out.println(speed);
+ //int i = 0;
+ while(speed > MAX_SPEED) {
+ velocity.scale(.99f);
+ speed = velocity.length();
+ //i++;
+ }
+ //System.out.println(i);
+
+ super.updateState(duration);
+ }
+
}