Camera Zoom

I did a search on this in these forums, but I couldn’t really find a good solution. Does anyone have any good camera zoom scripts that will work in the GE (or a way to fake it?) My attempt to figure it out on my own left me stupider than before when I tried to set the camera viewport to a larger size than the screen. I’m retarded when it comes to python, so any help is apreciated. Thanks.

by default the camera is facing along its local Z axis…

so basically you can move the camera on the local Z to simulate a zoom effect.

It is possible to do this with an IPO also, an IPO actuator set to property will give you the most control.

yeah, but won’t it go through objects between the start and end point of the ipo?

I was thinking of something like using a ray sensor with python to get the distance of an object in front of the camera, and then setting the camera’s position at a fraction of that distance. (so basically 1/2 the distance would be a 2x zoom) I just now thought of another possibility that wouldn’t need python. What if you had both the camera and some sort of wall (at the maximum zoom distance) parented to an empty, and then moved the camera forward. That way, it would stop if it hit the “wall” or any other object inbetween. I guess there might be a problem, since the camera would have to be dynamic, and then you wouldn’t be able to zoom back out if another object came between the camera and empty. I’m just confusing myself again…:spin:

a simpler answer is to adjust the lens value; a higher number is zoomed in farther, lower numbers are wider view angle. I believe 50 is about average human vision. you can adjust it with python, or make an IPO and play with IPO actuators (which is what I do- simpler, and smoother results)
the problem with panning forwards instead of zooming is that you can see the parallax (closer things moving wile farther away things stay in place), so it doesn’t look like a zoom.

Thanks, I didn’t even think about changing the lens angle. What would that script look like? Would I just go like “getObjectList[“Camera”].setLensValue(…)”? I can’t realy mess around with it right now.

The easiest way to do it is with an IPO curve for the Lens factor. You can then adjust the zoom by playing the IPO with a Property-controlled IPO actuator.

Using the Lens factor rather than moving the camera creates a true zoom, and thus is preferable.

Sorry, but is Lens Factor even an option for an ipo curve?

hover your mouse over the window in which you edit the lens value (edit buttons, with the camera selected) and press I; it should be there. alternatively, you can go to the IPO curves window and manually edit it. I suggest this method, due to the greater level of control it gives you.

Thanks guys, that’s exactly what I was trying to do. I didn’t even know it could be done without programming. But it seems like you should be able to change the view angle just be scaling up the camera on the local z. Oh well, the ipo isn’t any more difficult, thanks again.

There is another way, without using that, but it’s just instant zoom, that you can use for binocular effect. Create another camera and make it zoom in a lot. Make something with a scene actuator, Here, let me just make a blendfile;)…
Here it is…
Hold the Right Mouse button to zoom…