Jump to content
  • Advertisement
Sign in to follow this  
jnrprogrammer

vectors

This topic is 4043 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

Im using a book to learn 3d maths which goes through various equations but there are no examples where i might want to use them in a game. where and why would i use the dot product and cross product?

Share this post


Link to post
Share on other sites
Advertisement
Lots of places, really. The cross product of two vectors gives you the normal to the plane they define, which I've used to generate normals for heightmapped terrain, and is a key part of building the camera(/view/eye) transform.

Dot products are used in lighting equations, collision detection, and tons of other areas.

Share this post


Link to post
Share on other sites
Dot product:

how much do i have to turn to face my enemy
is my new position going to be on the other side of my enemy
is a polygon facing the camera
and 1 million other reasons


Cross product:
do i turn left or right to face my target
if i'm here and my enemy is there, what's the vector pointing to my right
for physics: what's the normal to this surface?
and a million other reasons

I use dot product and cross product at least a few times each day working in AI. probably more than any other bit of math outside of basic operations (+ - * /)

-me

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!