public class Vehicle extends MovingEntity
BaseEntity.DepthOrder
tag, tagNo
Constructor and Description |
---|
Vehicle(java.lang.String name,
Vector2D position,
double radius,
Vector2D velocity,
double max_speed,
Vector2D heading,
double mass,
double max_turn_rate,
double max_force)
The constructor that should be used when creating a Vehicle with a name.
|
Vehicle(Vector2D position,
double radius,
Vector2D velocity,
double max_speed,
Vector2D heading,
double mass,
double max_turn_rate,
double max_force)
The constructor that should be used when creating a Vehicle without a name.
|
Modifier and Type | Method and Description |
---|---|
AutoPilot |
AP()
Use this to access the auto-pilot object so that it can be modified.
|
Vehicle |
AP(AutoPilot ap)
Set the auto-pilot to use with this entity.
|
ForceRecorder |
forceRecorder()
Get the force recorder if this vehicle has one.
|
Vehicle |
forceRecorderOff()
Dump the force recorder on for this Vehicle.
|
Vehicle |
forceRecorderOn()
Enable the force recorder on for this Vehicle.
|
boolean |
hasForceRecorder()
See if this vehicle has a force recorder.
|
static Vehicle[] |
makeFromXML(java.io.File xmlFile)
Alternative if not using Processing
|
static Vehicle[] |
makeFromXML(processing.core.PApplet app,
java.lang.String xmlFilename)
This is the one to use with Processing
|
static Vehicle[] |
makeFromXML(java.lang.String xmlFilename)
Alternative if not using Processing
|
double |
maxForce()
Get the maximum force that can be applied to this entity
|
void |
printForceData()
Display the steering force data for this Vehicle.
|
java.lang.String |
toString()
Entity ID number and name returned as a String
|
void |
update(double deltaTime,
World world)
Update method for any moving entity in the world that is under
the influence of a steering behaviour.
|
canSee, canSee, draw, draw, heading, heading, heading, headingAtRest, headingAtRest, isEitherSide, isInDomain, isOver, isSpeedMaxedOut, mass, mass, maxForce, maxSpeed, maxSpeed, maxTurnRate, maxTurnRate, prevPos, rotateHeadingToAlignWith, rotateHeadingToFacePosition, side, speed, speedSq, turnRate, turnRate, velocity, velocity, velocity, viewDistance, viewDistance, viewFactors, viewFOV, viewFOV, worldDomain, worldDomain, worldDomain, worldDomainConstraint, worldDomainConstraint
public Vehicle(Vector2D position, double radius, Vector2D velocity, double max_speed, Vector2D heading, double mass, double max_turn_rate, double max_force)
position
- initial world positionradius
- bounding radiusvelocity
- initial velocitymax_speed
- maximum speedheading
- initial headingmass
- initial massmax_turn_rate
- how fast the entity can turn (radians / second)max_force
- the maximum force that can be applied by a steering behaviourpublic Vehicle(java.lang.String name, Vector2D position, double radius, Vector2D velocity, double max_speed, Vector2D heading, double mass, double max_turn_rate, double max_force)
name
- optional name for the entityposition
- initial world positionradius
- bounding radiusvelocity
- initial velocitymax_speed
- maximum speedheading
- initial headingmass
- initial massmax_turn_rate
- how fast the entity can turn (radians / second)max_force
- the maximum force that can be applied by a steering behaviourpublic static Vehicle[] makeFromXML(processing.core.PApplet app, java.lang.String xmlFilename)
app
- xmlFilename
- public static Vehicle[] makeFromXML(java.lang.String xmlFilename)
xmlFilename
- name of the file to parsepublic static Vehicle[] makeFromXML(java.io.File xmlFile)
xmlFile
- File to parsepublic Vehicle AP(AutoPilot ap)
ap
- an available steering behaviourpublic AutoPilot AP()
public double maxForce()
maxForce
in class MovingEntity
public Vehicle forceRecorderOn()
public Vehicle forceRecorderOff()
public ForceRecorder forceRecorder()
public boolean hasForceRecorder()
public void printForceData()
public void update(double deltaTime, World world)
update
in class MovingEntity
deltaTime
- elapsed time since last updateworld
- the game world objectpublic java.lang.String toString()
BaseEntity
toString
in class BaseEntity
Processing library AI_for_2D_Games by Peter Lager. (C) 2013