Vector3 operation question

Started by
4 comments, last by Dave Hunt 18 years, 1 month ago
I have 2 points: Vector3 vPos, vLookAt;

Vector3 vNewDir = Vector3.Subtract(vPos, vLookAt);
Vector3 vNewPos = Vector3.Add(vPos, vNewDir);

After these 2 operations, shouldn't vNewPos = vLookAt
Advertisement
It might, depending on the order of the subtraction in Subtract(). But then you can always change the order of the parameters. Why don't you try it out?
No.

8 = 10 - 2
18 = 10 + 8
I am missing something...

v = p2 - p1


Point direction form of a ray:
p2(t) = p1 + v(t)

when t = 1

p2 = p1 + v


p1 = 5, p2 = 2

v = 2 - 5

2 = 5 + -3
ok .. i see it . my post was inconsistent with the code. please cut me some slack .. i am somewhat new to this :)
Quote:Original post by pbergeron
ok .. i see it . my post was inconsistent with the code.


No worries. I figured it was something like that.

This topic is closed to new replies.

Advertisement