Class Bullet

  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.GroupNode
              extended by org.xith3d.scenegraph.Group
                  extended by org.xith3d.scenegraph.TransformGroup
                      extended by org.xith3d.schedops.movement.Bullet
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode, Animatable, ScheduledOperation, Updatable, Transformable

public abstract class Bullet
extends TransformGroup
implements Animatable

This class can be used as a base for a bullet. Add it to the scheduler of an ExtRenderLoop by calling the method addScheduledOperation(bullet). It is automatically removed from its parent BranchGroup and the scheduler when maxLifetime has been reached.

Field Summary
Fields inherited from class org.xith3d.scenegraph.GroupNode
children, hostGroup, numChildren, totalNumChildren, totalNumShapes
Fields inherited from class org.xith3d.scenegraph.Node
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, transformGroup, untransformedBounds
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
Constructor Summary
Bullet(org.openmali.vecmath2.Vector3f velocity, long maxLifeTime)
          Creates a new Bullet.
Method Summary
 long getLifeTime()
 org.openmali.vecmath2.Tuple3f getLocation()
 long getMaxLifeTime()
 float getSpeed()
 org.openmali.vecmath2.Vector3f getVelocity()
 boolean isAlive()
          if false, the object will be removed from the scheduler next loop iteration
 boolean isAnimating()
          A Bullet's animation is always running until it is dead.
 boolean isPersistent()
          A Bullet is always persistent until it is dead.
 void setAlive(boolean alive)
          Sets this Object alive or dead.
 void setLocation(org.openmali.vecmath2.Tuple3f location)
          Sets this Bullet's current location.
 void setMaxLifeTime(long maxLifeTime)
          Sets the maximum time, this Bullet will be alive.
 void setSpeed(float speed)
          Sets this Bullet's speed along its velocity vector.
 void setVelocity(org.openmali.vecmath2.Vector3f velocity)
          Sets this bullet's velocity vector.
 void startAnimation(long gameTime, UpdatingThread.TimingMode timingMode)
          Starts the animation of this Bullet.
 void stopAnimation()
          A Bullet's animation cannot be stopped.
 void update(long gameTime, long frameTime, UpdatingThread.TimingMode timingMode)
          Updates this Updatable object.
Methods inherited from class org.xith3d.scenegraph.TransformGroup
getLocalTransform, getLocalTransform, getPosition, getPosition, getTransform, getTransform, getWorldTransform, newInstance, onTransformChanged, setLocalTransform, setPosition, setPosition, setTransform, traverse, updateTransform
Methods inherited from class org.xith3d.scenegraph.Group
Methods inherited from class org.xith3d.scenegraph.GroupNode
absorbDetails, addChild, addChild, checkChild, dump, dump, ensureCapacity, expandBounds, findAll, findAll, findFirst, findFirst, freeOpenGLResources, getChild, getChildren, getChildren, getClipper, getPickHost, getScissorRect, getTotalNumChildren, getTotalNumShapes, indexOf, isPickHost, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, numChildren, removeAllChildren, removeChild, removeChild, setBoundsDirty, setBoundsDirtyUpward, setChild, setClipper, setLive, setPickHost, setPickHost, setScissorRect, setShowBounds, sharedCopy, sharedCopy, traverse, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateBounds, updateBoundsCheap
Methods inherited from class org.xith3d.scenegraph.Node
cloneNode, detach, duplicateNode, freeOpenGLResources, getBounds, getBoundsAutoCompute, getBoundsType, getBoundsTypeHint, getDefaultPickable, getIndentString, getInheritedNodeAttributes, getModListener, getOrderedChild, getOrderedState, getParent, getRoot, getShadowAttachment, getShowBounds, getTransformGroup, getTreeCell, getWorldBounds, getWorldTransform, isBillboard, isIgnoreBounds, isOccluder, isPickable, isRenderable, isUpdatableNode, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBounds, setBoundsAutoCompute, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setModListener, setOrderedChild, setParent, setPickable, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, updateOrderedChild, updateTransformGroup, updateWorldTransform
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.xith3d.scenegraph.Transformable
getName, setName

Constructor Detail


public Bullet(org.openmali.vecmath2.Vector3f velocity,
              long maxLifeTime)
Creates a new Bullet. This calls setVelocity, setLocation, setAlive, setMaxLifeTime.

velocity - the velocity vector this bullet will move along. Its length is the speed.
maxLifeTime - the maximum amount of milliseconds this bullet will remain in the scheduler.
Method Detail


public boolean isAnimating()
A Bullet's animation is always running until it is dead.

Specified by:
isAnimating in interface Animatable
is this object's animation running


public void startAnimation(long gameTime,
                           UpdatingThread.TimingMode timingMode)
Starts the animation of this Bullet.

Specified by:
startAnimation in interface Animatable


public void stopAnimation()
A Bullet's animation cannot be stopped. Use setAlive() instead.

Specified by:
stopAnimation in interface Animatable
See Also:


public boolean isPersistent()
A Bullet is always persistent until it is dead.

Specified by:
isPersistent in interface ScheduledOperation


public long getLifeTime()
the milliseconds this Bullet is alive.


public void setVelocity(org.openmali.vecmath2.Vector3f velocity)
Sets this bullet's velocity vector. The length of this vector is the speed.

velocity - the new velocity vector


public org.openmali.vecmath2.Vector3f getVelocity()
this Bullet's velocity vector. The length of this vector is the speed.


public void setLocation(org.openmali.vecmath2.Tuple3f location)
Sets this Bullet's current location.

location - the new location


public org.openmali.vecmath2.Tuple3f getLocation()
this Bullet's current location.


public float getSpeed()
this Bullet's speed along its velocity vector.


public void setSpeed(float speed)
Sets this Bullet's speed along its velocity vector.

speed - the new speed for this Bullet


public void update(long gameTime,
                   long frameTime,
                   UpdatingThread.TimingMode timingMode)
Updates this Updatable object.

Specified by:
update in interface Updatable
gameTime - the gameTime in Milliseconds
frameTime - the frameTime in Milliseconds (needed time for the last frame)
timingMode - the TimingMode to use for frameTime.


public void setMaxLifeTime(long maxLifeTime)
Sets the maximum time, this Bullet will be alive.

maxLifeTime - maximum life time in milliseconds


public long getMaxLifeTime()
the maximum time, this Bullet will be alive


public void setAlive(boolean alive)
Sets this Object alive or dead. If it is killed, is is also removed from its parent group.

Specified by:
setAlive in interface ScheduledOperation
alive - if false, the object will be removed from the scheduler next loop iteration


public boolean isAlive()
Description copied from interface: ScheduledOperation
if false, the object will be removed from the scheduler next loop iteration

Specified by:
isAlive in interface ScheduledOperation
false -> the object will be removed from the scheduler next loop iteration, true otherwise