From e3f6a4acb207064a1bc3fa87cb393bdfdd5acd62 Mon Sep 17 00:00:00 2001 From: Phillip Date: Wed, 16 Mar 2011 05:23:02 +0000 Subject: 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. --- src/tesseract/objects/tank/Tank.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/tesseract/objects/tank') 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); + } + } -- cgit v1.2.3