PDA

Click to See Complete Forum and Search --> : Move in a 3D Line, 2points


Halsafar
Nov 17th, 2004, 08:18 PM
Alright, I have a camera at point (-50,-50,-50)
I want it to move at a certain rate to (50,75,100);

But I want it to ratio its movement as to arrive at that destination in a line.

How do I walk the line between those two points.

An example would be great.

opus
Nov 17th, 2004, 11:54 PM
Never worked in 3D, but to get the values I think you just need the difference in each D (like: (50-(-50),75-(-50),100-(-50)). That would be the total vector, to make a move along this vector(or line) just divide it in your neccessary steps.

azteched
Nov 18th, 2004, 11:03 AM
dx = k(50 - -50)
dy = k(75 - -50)
dz = k(100 - -50)

where k is some constant that you choose to determine the camera speed.

Each tick the camera advances dx in the x-dir, dy in y-dir, etc.