Sign in to follow this  
jnrprogrammer

vectors

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this