Jump to content
  • Advertisement
Sign in to follow this  
pbergeron

Vector3 operation question

This topic is 4614 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
ok .. i see it . my post was inconsistent with the code. please cut me some slack .. i am somewhat new to this :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!