3 Replies Latest reply on Jul 20, 2006 8:16 PM by Roofy

# Dynamically rotating/zooming camera to a certain position

Hi,

I am having some difficulties with dynamically zooming on a 3D model. I want to zoom back to a predefined camera position after the user has orbited and zoomed around the model freely using the mouse, with animation.

I have a frame handler that moves and rotates the camera in several steps (i.e. with a maximum "speed"), back to the desired position, by comparing the camera's current XYZ position with target XYZ.

This works, but if I want to zoom back to a position where the camera is still rotated, the zooming animation is far from smooth. It tends to move from left to right, back and forth, until it reaches its final position. I want to have it move in a STRAIGHT line.

Does anyone know how to accomplish this? I guess I would need to calculate some kind of path, but I can imagine there is a Lingo method to do this.

Thank you
• ###### 1. Re: Dynamically rotating/zooming camera to a certain position
I'm not sure if I have my head around the specifics you're going for, but in general I've had great success using bezier calculations. Paul Lemon opened it up for me when I found this:
I tend to chop his work up and poke it into my stuff.

You may be going for something a little more like the follow link. It's in progress so the instructions are missing. left click drag to rotate, right click to pan, click both mouse buttons and drag vertically to zoom.
http://www.stuffycorporatedesign.com/open/ss.htm
• ###### 2. Re: Dynamically rotating/zooming camera to a certain position
Thanks. The magic word I was looking for is "interpolate", but bezier calculations is even better because it gives you the option to add several "waypoints" in your trajectory.

Nice galaxy, by the way. :-)
• ###### 3. Dynamically rotating/zooming camera to a certain position
quote:

Originally posted by: Paulygon
http://www.stuffycorporatedesign.com/open/ss.htm

I know this post is old, but you would not happen to have the script for the above demo would ya?
I ask this because, I am trrying to orbit my camera arround an object and I am not getting the results as in the above shockwave 3d demo.

I am have tried rotating with the below method but it causes the camera to fly all over the place...
pCamera.rotate(dx, dy, 0, sprite(me.spriteNum).member.model("box"))

... where dx dy are the rotation angles that I have calculated from where the mouse is located