|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjme.physics.mobile.LandMobility
LandMobility handles the acceleration and velocity of a
land vehicle. It is set such that to move forward/backward the entity is
accelerated/decelerated. The velocity of entity is determined by:
V1 = V0 + a(t). Turning is also determined by a set turning velocity.
Future enhancements should include using the normal of the geometry moving
over to for friction, gravity changes.
| Constructor Summary | |
LandMobility()
Constuctor instantiates a new LandMobility object. |
|
| Method Summary | |
float |
getCurrentAngle()
getCurrentAngle returns the current angle the entity is
facing. |
float |
getCurrentTurningVel()
getCurrentTurningVel returns the current velocity of turning. |
float |
getCurrentVelocity()
getCurrentVelocity returns the current velocity of the
entity. |
void |
move(float accelerationScalar)
move sets the current acceleration to the base acceleration
to the acceleration scalar. |
void |
setBaseAcceleration(float baseAcceleration)
setBaseAcceleration sets the acceleration of the entity. |
void |
setCoastDeceleration(float coastDeceleration)
setCoastDeceleration sets the deceleration rate of the
entity. |
void |
setCurrentAngle(float currentAngle)
setCurrentAngle sets the current angle of the entity. |
void |
setMaxVelocity(float maxVelocity)
setMaxVelocity sets the maximum velocity the entity is
allowed to obtain. |
void |
setMinVelocity(float minVelocity)
setMinVelocity sets the minimum velocity (backward movement)
the entity is allowed to obtain. |
void |
setTurningVelocity(float f)
setTurningVelocity sets the rate at which the entity can
turn. |
void |
strafe(float strafeScalar)
strafe sets the current acceleration to the base strafe
acceleration to the acceleration scalar. |
void |
turn(float turnScalar)
turn affects the current turning velocity, where negative
one turns right by the set turning velocity and positive one turns left
by the set turning velocity. |
void |
update(float time)
update calculates the current velocity of the entity,
as well as the current angle the entity is facing. |
void |
updatePosition(Vector position)
updatePosition sets the entities new position based on
it's current velocity and angle. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public LandMobility()
LandMobility object.
| Method Detail |
public void update(float time)
update calculates the current velocity of the entity,
as well as the current angle the entity is facing. This is scaled by
the current time frame sent as a parameter. This insures independance
from the framerate.
update in interface PhysicsModuletime - the time between updates.public void updatePosition(Vector position)
updatePosition sets the entities new position based on
it's current velocity and angle.
updatePosition in interface PhysicsModuleposition - the position to update.public void turn(float turnScalar)
turn affects the current turning velocity, where negative
one turns right by the set turning velocity and positive one turns left
by the set turning velocity. For increases of turning speed increase the
scalar and vice versa for decreasing.
turn in interface PhysicsModuleturnScalar - the amount to multiply the turning velocity by.public void move(float accelerationScalar)
move sets the current acceleration to the base acceleration
to the acceleration scalar. Therefore, if you wanted to move forward
at full speed the accelerationScalar would be set to 1. If you wanted
to decelerate by half the speed (-0.5).
move in interface PhysicsModuleaccelerationScalar - the scalar to multiply the baseAcceleration and
set the current acceleration.public void strafe(float strafeScalar)
strafe sets the current acceleration to the base strafe
acceleration to the acceleration scalar. Therefore, if you want to strafe
to the right, you would set it to -1. To the left would be 1.
strafe in interface PhysicsModulestrafeScalar - is the scalar to multiply the strafe acceleration
by.public void setCoastDeceleration(float coastDeceleration)
setCoastDeceleration sets the deceleration rate of the
entity. This value is used when the entity is not actively moving.
coastDeceleration - the deceleration rate of the entity.public void setMaxVelocity(float maxVelocity)
setMaxVelocity sets the maximum velocity the entity is
allowed to obtain.
maxVelocity - the maximum velocity of the entity.public void setMinVelocity(float minVelocity)
setMinVelocity sets the minimum velocity (backward movement)
the entity is allowed to obtain.
minVelocity - the minimum velocity of the entity.public void setTurningVelocity(float f)
setTurningVelocity sets the rate at which the entity can
turn.
public void setBaseAcceleration(float baseAcceleration)
setBaseAcceleration sets the acceleration of the entity.
This base is used to determine the velocity of the entity.
baseAcceleration - the base (unmodified) acceleration rate of the
entity.public void setCurrentAngle(float currentAngle)
setCurrentAngle sets the current angle of the entity.
Effectively rotating the entity instantly.
currentAngle - the angle to set the entity to.public float getCurrentAngle()
getCurrentAngle returns the current angle the entity is
facing.
getCurrentAngle in interface PhysicsModulepublic float getCurrentVelocity()
getCurrentVelocity returns the current velocity of the
entity.
getCurrentVelocity in interface PhysicsModulepublic float getCurrentTurningVel()
getCurrentTurningVel returns the current velocity of turning.
getCurrentTurningVel in interface PhysicsModule
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||