T
- public abstract class Body extends java.lang.Object implements java.lang.Comparable<Body>, java.io.Serializable, java.lang.Cloneable
Pilot
s and scapegoat of this simulation,
the Panzer
is the physical and destructible representation of
this fancy knob running about in the arena, casting volleys and transiting
to the wasteDump
, finally.Modifier and Type | Class and Description |
---|---|
class |
Body.BodyTractor
To allow flexibility of
Body physics, the tractors are rendered individually. |
Modifier and Type | Field and Description |
---|---|
java.util.ArrayList<Directable> |
missileLink
To be able to influence
Directable devices, the
Panzer holds these references. |
protected java.util.List<Body.BodyTractor> |
tractors
the wheels on the bus
|
int |
turretIndex |
Constructor and Description |
---|
Body(AbstractPilot pilot,
int turretIndex,
Vector pos,
Angle ori)
Constructor with defined position for debug porposes.
|
Modifier and Type | Method and Description |
---|---|
void |
activateLinkToDirectables()
updates commands to the linked Directable
|
void |
applyMotionTarget(MotionTargetPanzer target,
SimulationMode simulationMode) |
AbstractPilot |
attachNewPilot(AbstractPilot pilot,
double detriment)
A new Pilot is constituted as the Panzer's driver.
|
MotionTargetPanzer |
calculateMotion(SimulationMode simulationMode,
double elapsedTime)
Renders where the
Panzer may be when
elapsedTime has past and returns a
MotionTargetPanzer with that information. |
void |
chargeEnergy(double elapsedTime,
double factor)
Adds to the
Panzer 's energy. |
int |
compareTo(Body o) |
boolean |
depleteEnergyBulky(double amount)
Removes a chunk of energy.
|
double |
depleteEnergyFlexibly(double amount)
Removes energy.
|
void |
doDamage(double damage)
does scaled damage relative to the type of
Body |
abstract void |
draw(javax.media.opengl.GL gl,
ArenaController arenaController)
calls a specific drawing routine
|
abstract void |
drawTracks(javax.media.opengl.GL gl,
ArenaController arenaController)
calls a specific drawing routine
|
abstract void |
drawTurret(javax.media.opengl.GL gl,
ArenaController arenaController,
double timestamp)
calls a specific drawing routine
|
Droppable[] |
drop(double simulationTime) |
void |
exertForce(MotionTargetPanzer.BodySide grip,
Vector force) |
void |
exertForce(MotionTargetPanzer.BodyVertex grip,
Vector force) |
void |
exertForce(Vector gripVector,
Vector force)
Exerts a given force for the time of one simulation step.
|
abstract double |
getBodyBreadth() |
protected abstract double |
getBodyDiagonal() |
abstract double |
getBodyLength() |
abstract double |
getBodyMass() |
abstract double |
getBodyMomentOfInertia() |
float[] |
getDebugLines()
Other classes may access
Pilot.getDebugLines |
java.lang.String |
getDebugText()
Other classes may access
Pilot.getDebugText |
protected double |
getECellStoreFractionFactor()
Energy cell store efficiency factor for the
exp function. |
double |
getEnergy()
Values for comparison:
maximum energy level driving at full speed: 2.408
energy level after being idle for 1 second: 0.2787
energy level after being idle for 3 seconds: 0.741
energy level after being idle for 10 seconds: 1.83
energy level driving at full speed for 1 second: 0.194
energy level driving at full speed for 3 seconds: 0.514
energy level driving at full speed for 10 seconds: 1.22
|
protected abstract double |
getEnergyProductionPerSecond() |
protected abstract double |
getEngineForce() |
protected abstract double |
getFrictionAngular() |
protected abstract double |
getFrictionFactorFrontal(TerrainType surface)
Surface properties are different for different ies.
|
protected abstract double |
getFrictionFactorLateral(TerrainType surface)
Surface properties are different for different ies.
|
protected abstract double |
getFrictionFrontal() |
protected abstract double |
getFrictionLateral() |
double |
getHealth() |
int |
getID() |
protected double |
getMaxSpeedBackward() |
protected abstract double |
getMaxSpeedBoosting() |
protected double |
getMaxSpeedForward() |
Angle |
getOrientation() |
AbstractPilot |
getPilot() |
Vector |
getPos() |
Angle |
getScanAperture()
Other classes may access
Pilot.getScanAperture |
Angle |
getScanDirection()
Other classes may access
Pilot.getScanDirection . |
double |
getSonarEnergy()
Other classes may access
Pilot.getScanDirection . |
double |
getTimeOfLastScan()
Access to
Panzer.lastScan.timeOfScan |
java.util.List<Body.BodyTractor> |
getTractors() |
Vector |
getVelocityLinear() |
protected abstract double |
getVelocityLossFactorPerSecondAngular() |
protected abstract double |
getVelocityLossFactorPerSecondFrontal() |
protected abstract double |
getVelocityLossFactorPerSecondLateral() |
protected abstract Vector |
handleBoosting(double elapsedTime)
applies the booster, if activated.
|
void |
init(double simulationTime)
Do not forget to initialize the
Panzer before processing the
Simulation the first time. |
protected abstract java.util.List<Body.BodyTractor> |
initTractors()
called once at creation time.
|
protected boolean |
isBoosting()
determines if the booster is to be ignited.
|
boolean |
isScannerReloaded(double simulationTime) |
Launchable[] |
launch(double simulationTime) |
void |
processPilotCommands(double simulationTime)
Executes the
Pilot 's actions Method, applies
commands and performs shooting and scanning. |
void |
resetPhysics()
Sets the collision frame time to zero, thus marking the beginning
of the collision frame for this simulation step.
|
void |
setHealth(double health) |
void |
setIsMovingInWrongDirection(boolean isMovingInWrongDirection) |
void |
setLastScan(Scan scan)
Access to
Panzer.lastScan |
void |
setLastSonarTrace(SonarTrace sonarTrace)
Access to
Panzer.lastsonarTrace |
void |
setPosOfBestBot(Vector posOfBestBot) |
void |
setProximityScanDroppable(Vector proximityPos) |
void |
setProximityScanLaunchable(ProximityScan proximityPos) |
void |
setTimeOfDropperReloaded(double time)
Access to
Panzer.timeOfDropperReloaded |
void |
setTimeOfLauncherReloaded(double time)
Access to
Panzer.timeOfLastShot |
void |
zombificatePilot()
Upon the numerous things a Panzer can do to its Pilot,
this one is especially gruesome:
It is about removing its brain and making it a zombie. |
public java.util.ArrayList<Directable> missileLink
Directable
devices, the
Panzer
holds these references.
Note: The references are single-sided and may be null.
protected final java.util.List<Body.BodyTractor> tractors
public final int turretIndex
public Body(AbstractPilot pilot, int turretIndex, Vector pos, Angle ori)
pos
- - if null, a random Position will be chosenorientation
- - if null, a random Orientation will be chosenpublic void activateLinkToDirectables()
public void applyMotionTarget(MotionTargetPanzer target, SimulationMode simulationMode)
public AbstractPilot attachNewPilot(AbstractPilot pilot, double detriment)
pilot
- new Panzer's commanderdetriment
- how much health this procedure costs - Pilots are bulkypublic final MotionTargetPanzer calculateMotion(SimulationMode simulationMode, double elapsedTime)
Panzer
may be when
elapsedTime
has past and returns a
MotionTargetPanzer
with that information.
No state change is made.
Before calling this method in each simulation frame,
processPilotCommands
is to be called, as steering commands
affect movement.
simulationMode
- needed for specific motion rules for simulationModeelapsedTime
- >= Constants.FLOATING_POINT_PRECISION
public void chargeEnergy(double elapsedTime, double factor)
Panzer
's energy.
State change: Only a part of the generated energy is stored in the energy cell.
[s]
- time to chargefactor
- - linearpublic int compareTo(Body o)
compareTo
in interface java.lang.Comparable<Body>
public boolean depleteEnergyBulky(double amount)
public visibility because of scanning done by Simulation.
Panzer
has enough energy
(state change: energy removed) Panzer
has not enough energy (no state change)public double depleteEnergyFlexibly(double amount)
public void doDamage(double damage)
Body
public abstract void draw(javax.media.opengl.GL gl, ArenaController arenaController)
gl
- arenaController
- public abstract void drawTracks(javax.media.opengl.GL gl, ArenaController arenaController)
gl
- arenaController
- public abstract void drawTurret(javax.media.opengl.GL gl, ArenaController arenaController, double timestamp)
gl
- arenaController
- timestamp
- public Droppable[] drop(double simulationTime)
public void exertForce(MotionTargetPanzer.BodySide grip, Vector force)
grip
- the force is exerted at the side's center pointforce
- amount and direction of the force (important:
global axes) [N]Panzer.exertForce(Vector gripVector, Vector force)
public void exertForce(MotionTargetPanzer.BodyVertex grip, Vector force)
grip
- the point at which the force is exertedforce
- amount and direction of the force (important:
global axes) [N]Panzer.exertForce(Vector gripVector, Vector force)
public void exertForce(Vector gripVector, Vector force)
Issues exist:
MotionTargetPanzer
), the grip vector
is calculated here on base of the Panzer.orientation
at the
beginning of the momentary collision frame. However, as panzers move
slowly, this issue will be of negligible effect.
grip
- the point at which the force is exerted (global axes,
relative to this.pos)force
- amount and direction of the force (important:
global axes) [N]public abstract double getBodyBreadth()
protected abstract double getBodyDiagonal()
public abstract double getBodyLength()
public abstract double getBodyMass()
public abstract double getBodyMomentOfInertia()
public final float[] getDebugLines()
Pilot.getDebugLines
public final java.lang.String getDebugText()
Pilot.getDebugText
protected double getECellStoreFractionFactor()
exp
function.
smaller values mean less efficiency. Zero means no energy losses.
public double getEnergy()
protected abstract double getEnergyProductionPerSecond()
protected abstract double getEngineForce()
protected abstract double getFrictionAngular()
protected abstract double getFrictionFactorFrontal(TerrainType surface)
surface
- protected abstract double getFrictionFactorLateral(TerrainType surface)
surface
- protected abstract double getFrictionFrontal()
protected abstract double getFrictionLateral()
public double getHealth()
public int getID()
protected final double getMaxSpeedBackward()
protected abstract double getMaxSpeedBoosting()
protected final double getMaxSpeedForward()
public Angle getOrientation()
public final AbstractPilot getPilot()
public Vector getPos()
public final Angle getScanAperture()
Pilot.getScanAperture
The result will never be null.
public final Angle getScanDirection()
Pilot.getScanDirection
.
null
.public final double getSonarEnergy()
Pilot.getScanDirection
.
null
.public double getTimeOfLastScan()
Panzer.lastScan.timeOfScan
public final java.util.List<Body.BodyTractor> getTractors()
public Vector getVelocityLinear()
protected abstract double getVelocityLossFactorPerSecondAngular()
protected abstract double getVelocityLossFactorPerSecondFrontal()
protected abstract double getVelocityLossFactorPerSecondLateral()
protected abstract Vector handleBoosting(double elapsedTime)
elapsedTime
- public void init(double simulationTime)
Panzer
before processing the
Simulation
the first time.
Some Pilot
s depend on initialization and refuse to work
otherwise.protected abstract java.util.List<Body.BodyTractor> initTractors()
Body.BodyTractor
s are constant over the lifetime of this Body
.Body
protected boolean isBoosting()
public boolean isScannerReloaded(double simulationTime)
public Launchable[] launch(double simulationTime)
simulationTime
- public void processPilotCommands(double simulationTime)
Pilot
's actions
Method, applies
commands and performs shooting and scanning. Only moving is not done.
To move, call calculateMotion
afterwards and finally
applyMotionTarget
.
Don't call this method directly, as it executes external code. Take
use of the PilotCommandProcessor
instead.
Note: This method does not change the physical state of the Panzer. Only those fields responsible for steering the tank may be changed.
simulationTime
- current simulation time (should be greater than time
argument of last call)PilotCommandProcessor
public void resetPhysics()
public final void setHealth(double health)
public final void setIsMovingInWrongDirection(boolean isMovingInWrongDirection)
isMovingInWrongDirection
- write access to Body.isMovingInWrongDirection
public final void setLastScan(Scan scan)
Panzer.lastScan
public final void setLastSonarTrace(SonarTrace sonarTrace)
Panzer.lastsonarTrace
public final void setPosOfBestBot(Vector posOfBestBot)
posOfBestBot
- write access to Body.posOfBestBot
public final void setProximityScanDroppable(Vector proximityPos)
public final void setProximityScanLaunchable(ProximityScan proximityPos)
public final void setTimeOfDropperReloaded(double time)
Panzer.timeOfDropperReloaded
public final void setTimeOfLauncherReloaded(double time)
Panzer.timeOfLastShot
public void zombificatePilot()
Necessity arises