Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °
You are not logged in.
Post a reply
Topic review (newest first)
Ah, sorry, I misread your post. But yes, that is precisely right. By multiplying the vector by -1, you are reversing it's direction, so in front becomes behind.
Thanks Ricky, I think I got it to work.
You have a points A and B, (ax, ay) and (bx, by). The vector between these two points is <ax - bx, ay - by>, going from B to A. Now what you need is the unit vector. To get this, we divide that vector by it's length. So let L = √( (ax - bx)² + (ay - by)² ), which is the length. <(ax - bx) / L, (ay - by) / L> is the unit vector. Then multiply this by the distance you want the camera, D: <D*(ax - bx) / L, D*(ay - by) / L>.
Thanks a lot for responding so quick and great forum (it took me about 5 secs of googling to find it)!
It is actually easy if you know more about the position of A and B. You probably won't need sine or cosine.