ChaseCamera creates 3 vectors per update

ChaseCamera creates 3 vectors per update.



[patch]

Index: src/core/com/jme3/input/ChaseCamera.java

===================================================================

— src/core/com/jme3/input/ChaseCamera.java (revision 6582)

+++ src/core/com/jme3/input/ChaseCamera.java (working copy)

@@ -91,9 +91,9 @@

private boolean targetMoves = false;

private boolean enabled = true;

private Camera cam = null;

  • private Vector3f targetDir;
  • private final Vector3f targetDir = new Vector3f();

    private float previousTargetRotation;
  • private Vector3f pos;
  • private final Vector3f pos = new Vector3f();

    protected boolean dragToRotate = true;

    protected Vector3f lookAtOffset = null;

    protected boolean invertYaxis=false;

    @@ -197,8 +197,8 @@

    private void computePosition() {



    float hDistance = (distance) * FastMath.sin((FastMath.PI / 2) - vRotation);
  •    pos = new Vector3f(hDistance * FastMath.cos(rotation), (distance) * FastMath.sin(vRotation), hDistance * FastMath.sin(rotation));<br />
    
  •    pos = pos.add(target.getWorldTranslation());<br />
    
  •    pos.set(hDistance * FastMath.cos(rotation), (distance) * FastMath.sin(vRotation), hDistance * FastMath.sin(rotation));<br />
    
  •    pos.addLocal(target.getWorldTranslation());<br />
    

}



//rotate the camera around the target on the horizontal plane

@@ -253,7 +253,7 @@

if (enabled) {

if (smoothMotion) {

//computation of target direction

  •            targetDir = target.getWorldTranslation().subtract(prevPos);<br />
    
  •            targetDir.set(target.getWorldTranslation()).subtractLocal(prevPos);<br />
    

float dist = targetDir.length();



//Low pass filtering on the target postition to avoid shaking when physics are enabled.



[/patch]

good go ahead commit :smiley:

Thanks. Committed in svn. rev. 6584