how do I zoomIn /moveForward for camera?

HI I’m trying to Zoom In/out like how the default mouse wheel action achieves but by supplying the amount of zooming to be done.
I tried the zoomIn and the moveForward functions of the the camera, but don’t seem to get the correct zooming…

Really need some help to sort this out .

Check out the code in handleZoom: Essentially, you’re just modifying the camera distance from the origin, but when using the mouse, it’s not a linear scale and zooms in further the farther away you are from the surface.

Hi Matthew,
I looked at the code in handleZoom.I have a translation array with the translation in Z direction from the origin and for now I don’t need to worry about the non linear scale, the zooming can be linear.I can’t seem to get the proper zoom in and out with the change in translation form the origin.

I tried the following code:

i is the camera and I find the direction so that I can decide If I need to zoom in or out .I’m using a leap motion controller to find the translation in the hand.

I got it working:

var o = r.ellipsoid.cartesianToCartographic(i.position).height, u = o / 100;
var translationArr = hand._translation;
i.maximumZoomFactor = 1.2;
var distance = translationArr[2] - window.prevTranslation;
i.zoomIn(-distance * u);
window.prevTranslation = translationArr[2];

where i is the camera and the hand is the leap variable.

Thanks for all the help!