PDA

View Full Version : Angle between two points



Guilherme
05-08-2006, 09:56 PM
Hi there.
Can you help me?

I got two points(X,Y,Z) A and B in space.

How can I find the look vector from A to B grom a given moment?

I mean, at zero frame, "A" got no rotation at all.
And at frame 10, for example, "B" move 10 units on -X. How can I calculate the angle I have to rotate in "A" to continue viewing the "B" coordinate ?

iris_raj
05-08-2006, 11:04 PM
Dear Guilhereme,

1. lookAtVector = pointB - pointA
2. I am not sure But try this
a. value = ((pointB.x - 10)/lookAtVector.z)
b. angle = arctan(value);

Rajesh.R
IRIS,CAIR,
Bangalore - 1

zed
05-09-2006, 12:05 AM
search for 'The Matrix and Quaternions FAQ'
Q39. How do I generate a rotation matrix to map one vector onto another?

although How can I find the look vector from A to B grom a given moment?
is simple A-B perhaps normalize the result

Overmind
05-09-2006, 02:49 AM
The vector from A to B is B-A. It's always target minus source ;)