com.brackeen.javagamebook.math3D
Class MovingTransform3D

java.lang.Object
  extended bycom.brackeen.javagamebook.math3D.Transform3D
      extended bycom.brackeen.javagamebook.math3D.MovingTransform3D

public class MovingTransform3D
extends Transform3D

A MovingTransform3D is a Transform3D that has a location velocity and a angular rotation velocity for rotation around the x, y, and z axes.


Field Summary
static int FOREVER
           
 
Constructor Summary
MovingTransform3D()
          Creates a new MovingTransform3D
MovingTransform3D(Transform3D v)
          Creates a new MovingTransform3D, using the same values as the specified Transform3D.
 
Method Summary
 void addVelocity(Vector3D v)
          Adds the specified velocity to the current velocity.
 java.lang.Object clone()
           
 float getAngleVelocityX()
          Sets the angular speed of the x axis over the specified time.
 float getAngleVelocityY()
          Sets the angular speed of the y axis over the specified time.
 float getAngleVelocityZ()
          Sets the angular speed of the z axis over the specified time.
 long getRemainingMoveTime()
          Gets the amount of time remaining for this movement.
 Vector3D getVelocity()
          Gets the velocity vector.
 boolean isMoving()
          Returns true if currently moving.
 boolean isMovingIgnoreY()
          Returns true if currently moving, ignoring the y movement.
 boolean isTurningX()
          Returns true if the x axis is currently turning.
 boolean isTurningY()
          Returns true if the y axis is currently turning.
 boolean isTurningZ()
          Returns true if the z axis is currently turning.
 void moveTo(Vector3D destination, float speed)
          Sets the velocity to move to the following destination at the specified speed.
 void setAngleVelocityX(float speed)
          Sets the angular speed of the x axis.
 void setAngleVelocityX(float speed, long time)
          Sets the angular speed of the x axis over the specified time.
 void setAngleVelocityY(float speed)
          Sets the angular speed of the y axis.
 void setAngleVelocityY(float speed, long time)
          Sets the angular speed of the y axis over the specified time.
 void setAngleVelocityZ(float speed)
          Sets the angular speed of the z axis.
 void setAngleVelocityZ(float speed, long time)
          Sets the angular speed of the z axis over the specified time.
 void setVelocity(Vector3D v)
          Sets the velocity to the specified vector.
 void setVelocity(Vector3D v, long time)
          Sets the velocity.
 void stop()
          Stops this Transform3D.
 void turnXTo(float angleDest, float speed)
          Turns the x axis to the specified angle with the specified speed.
 void turnXTo(float y, float z, float angleOffset, float speed)
          Turns the x axis to face the specified (y,z) vector direction with the specified speed.
 void turnYTo(float angleDest, float speed)
          Turns the y axis to the specified angle with the specified speed.
 void turnYTo(float x, float z, float angleOffset, float speed)
          Turns the y axis to face the specified (x,z) vector direction with the specified speed.
 void turnZTo(float angleDest, float speed)
          Turns the z axis to the specified angle with the specified speed.
 void turnZTo(float x, float y, float angleOffset, float speed)
          Turns the z axis to face the specified (x,y) vector direction with the specified speed.
 void update(long elapsedTime)
          Updates this Transform3D based on the specified elapsed time.
 
Methods inherited from class com.brackeen.javagamebook.math3D.Transform3D
getAngleX, getAngleY, getAngleZ, getCosAngleX, getCosAngleY, getCosAngleZ, getLocation, getSinAngleX, getSinAngleY, getSinAngleZ, rotateAngle, rotateAngleX, rotateAngleY, rotateAngleZ, setAngle, setAngleX, setAngleY, setAngleZ, setTo
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FOREVER

public static final int FOREVER
See Also:
Constant Field Values
Constructor Detail

MovingTransform3D

public MovingTransform3D()
Creates a new MovingTransform3D


MovingTransform3D

public MovingTransform3D(Transform3D v)
Creates a new MovingTransform3D, using the same values as the specified Transform3D.

Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class Transform3D

update

public void update(long elapsedTime)
Updates this Transform3D based on the specified elapsed time. The location and angles are updated.


stop

public void stop()
Stops this Transform3D. Any moving velocities are set to zero.


moveTo

public void moveTo(Vector3D destination,
                   float speed)
Sets the velocity to move to the following destination at the specified speed.


isMoving

public boolean isMoving()
Returns true if currently moving.


isMovingIgnoreY

public boolean isMovingIgnoreY()
Returns true if currently moving, ignoring the y movement.


getRemainingMoveTime

public long getRemainingMoveTime()
Gets the amount of time remaining for this movement.


getVelocity

public Vector3D getVelocity()
Gets the velocity vector. If the velocity vector is modified directly, call setVelocity() to ensure the change is recognized.


setVelocity

public void setVelocity(Vector3D v)
Sets the velocity to the specified vector.


setVelocity

public void setVelocity(Vector3D v,
                        long time)
Sets the velocity. The velocity is automatically set to zero after the specified amount of time has elapsed. If the specified time is FOREVER, then the velocity is never automatically set to zero.


addVelocity

public void addVelocity(Vector3D v)
Adds the specified velocity to the current velocity. If this MovingTransform3D is currently moving, it's time remaining is not changed. Otherwise, the time remaining is set to FOREVER.


turnXTo

public void turnXTo(float angleDest,
                    float speed)
Turns the x axis to the specified angle with the specified speed.


turnYTo

public void turnYTo(float angleDest,
                    float speed)
Turns the y axis to the specified angle with the specified speed.


turnZTo

public void turnZTo(float angleDest,
                    float speed)
Turns the z axis to the specified angle with the specified speed.


turnXTo

public void turnXTo(float y,
                    float z,
                    float angleOffset,
                    float speed)
Turns the x axis to face the specified (y,z) vector direction with the specified speed.


turnYTo

public void turnYTo(float x,
                    float z,
                    float angleOffset,
                    float speed)
Turns the y axis to face the specified (x,z) vector direction with the specified speed.


turnZTo

public void turnZTo(float x,
                    float y,
                    float angleOffset,
                    float speed)
Turns the z axis to face the specified (x,y) vector direction with the specified speed.


setAngleVelocityX

public void setAngleVelocityX(float speed)
Sets the angular speed of the x axis.


setAngleVelocityY

public void setAngleVelocityY(float speed)
Sets the angular speed of the y axis.


setAngleVelocityZ

public void setAngleVelocityZ(float speed)
Sets the angular speed of the z axis.


setAngleVelocityX

public void setAngleVelocityX(float speed,
                              long time)
Sets the angular speed of the x axis over the specified time.


setAngleVelocityY

public void setAngleVelocityY(float speed,
                              long time)
Sets the angular speed of the y axis over the specified time.


setAngleVelocityZ

public void setAngleVelocityZ(float speed,
                              long time)
Sets the angular speed of the z axis over the specified time.


getAngleVelocityX

public float getAngleVelocityX()
Sets the angular speed of the x axis over the specified time.


getAngleVelocityY

public float getAngleVelocityY()
Sets the angular speed of the y axis over the specified time.


getAngleVelocityZ

public float getAngleVelocityZ()
Sets the angular speed of the z axis over the specified time.


isTurningX

public boolean isTurningX()
Returns true if the x axis is currently turning.


isTurningY

public boolean isTurningY()
Returns true if the y axis is currently turning.


isTurningZ

public boolean isTurningZ()
Returns true if the z axis is currently turning.