[Committed] Setting minDistance on ChaseCam can lead to wrong camera view distance

If the chase cam’s actual distance to its parent is smaller than the setMinDistance(someDistance) the camera view will not be properly updated and will potentially end up inside the parent.



For example:



Suppose the chase cam is attached to a spatial object. If you switch the view to a different object that is bigger and call setMinDistance(distance) on the chase cam to make sure the view is not inside that object, the view will not be updated until the camera is zoomed in or out. At that point the minDistance will be taken into account and properly updated.



The following patch addresses that problem.



EDIT: Might as well do the same for maxDistance.



[patch]

This patch file was generated by NetBeans IDE

It uses platform neutral UTF-8 encoding and n newlines.

— Base (BASE)

+++ Locally Modified (Based On LOCAL)

@@ -505,7 +505,10 @@

*/

public void setMaxDistance(float maxDistance) {

this.maxDistance = maxDistance;

  •    if (maxDistance &lt; distance) {<br />
    
  •        zoomCamera(maxDistance - distance);<br />
    

}

  • }



    /**
  • Returns the min zoom distance of the camera (default is 1)

    @@ -521,7 +524,10 @@

    */

    public void setMinDistance(float minDistance) {

    this.minDistance = minDistance;
  •    if (minDistance &gt; distance) {<br />
    
  •        zoomCamera(distance - minDistance);<br />
    

}

  • }



    /**
  • clone this camera for a spatial

    [/patch]



    Class is ready to be committed.
3 Likes

go ahead commit :wink:

thanks for the patch

Thanks.



Committed.