net.sf.tankbattles.scene.camera
Class CustomChaseCamera

java.lang.Object
  extended by com.jme.input.InputHandler
      extended by com.jme.input.ChaseCamera
          extended by net.sf.tankbattles.scene.camera.CustomChaseCamera

public class CustomChaseCamera
extends com.jme.input.ChaseCamera

Same original jME ChaseCamera with a different update method. Avoids getting updated by the main loop update method to avoid the sttutering. Adds a custom update method witch should be called after the physics update step.

Author:
Erick B Passos
See Also:
ChaseCameraUpdateCallback

Field Summary
 
Fields inherited from class com.jme.input.ChaseCamera
DEFAULT_DAMPINGK, DEFAULT_ENABLESPRING, DEFAULT_MAINTAINAZIMUTH, DEFAULT_MAXDISTANCE, DEFAULT_MINDISTANCE, DEFAULT_SPRINGK, DEFAULT_STAYBEHINDTARGET, DEFAULT_WORLDUPVECTOR, PROP_DAMPINGK, PROP_ENABLESPRING, PROP_INITIALSPHERECOORDS, PROP_MAINTAINAZIMUTH, PROP_MAXDISTANCE, PROP_MINDISTANCE, PROP_SPRINGK, PROP_STAYBEHINDTARGET, PROP_TARGETOFFSET, PROP_WORLDUPVECTOR
 
Fields inherited from class com.jme.input.InputHandler
AXIS_ALL, AXIS_NONE, BUTTON_ALL, BUTTON_NONE, DEVICE_ALL, DEVICE_KEYBOARD, DEVICE_MOUSE
 
Method Summary
 void customUpdate(float tpf)
          Custom update method to be called after physics update step.
static com.jme.input.ChaseCamera getInstance(com.jme.renderer.Camera camera, Mission mission)
          Factory method for initializing the ChaseCamera.
 void nextTarget()
          Sets the chaser to follow the next target (tank).
 void update(float tpf)
          Default empty update method that is invoked at the main loop.
 
Methods inherited from class com.jme.input.ChaseCamera
getCamera, getDampingK, getIdealPosition, getIdealSphereCoords, getMaxDistance, getMinDistance, getMouseLook, getSpeed, getSpringK, getTarget, getTargetOffset, isEnableSpring, isForceAzimuthUpdate, isLooking, isMaintainAzimuth, isStayBehindTarget, setActionSpeed, setCamera, setDampingK, setEnableSpring, setForceAzimuthUpdate, setIdealSphereCoords, setLooking, setMaintainAzimuth, setMaxDistance, setMinDistance, setSpringK, setStayBehindTarget, setTarget, setTargetOffset, setWorldUpVec, updateProperties
 
Methods inherited from class com.jme.input.InputHandler
addAction, addAction, addAction, addAction, addAction, addAction, addDevice, addToAttachedHandlers, clearActions, getBooleanProp, getDevices, getFloatProp, getFromAttachedHandlers, getIntProp, getObjectProp, getParent, isEnabled, removeAction, removeAction, removeAllActions, removeAllFromAttachedHandlers, removeFromAttachedHandlers, setActionSpeed, setEnabled, setEnabledOfAttachedHandlers, sizeOfAttachedHandlers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static com.jme.input.ChaseCamera getInstance(com.jme.renderer.Camera camera,
                                                    Mission mission)
Factory method for initializing the ChaseCamera. Sets the initial properties for restricting ChaseCamera movement.

Parameters:
camera - to have the position updated.
target - to be followed.
Returns:

nextTarget

public void nextTarget()
Sets the chaser to follow the next target (tank). Since we mantain a collection of the possible targets for the chase camera we just have to iterate over this collection and find the next one.


update

public void update(float tpf)
Default empty update method that is invoked at the main loop. Overrides original for doing nothing to avoid sttutering.

Overrides:
update in class com.jme.input.ChaseCamera
Parameters:
tpf - time per frame
See Also:
ChaseCameraUpdateCallback

customUpdate

public void customUpdate(float tpf)
Custom update method to be called after physics update step. Calls original update method, since after physics step is the safe moment to update the camera position.

Parameters:
tpf - time per frame
See Also:
ChaseCameraUpdateCallback