Game Development Community

vector questions

by rennie moffat · in Torque Game Builder · 03/17/2010 (7:41 am) · 4 replies

I have a few questions regarding vectors and there use.

t2dVectorDot(%vector1, %vector2)
-computes the dot product. the return, if the two vectors are normalized it returns the cosine of the angle between the two.

My question is, I know a normal is a perpendicular line, to the vector in question but how can the 2 be normalized? Can't there only be one normal per line? because altho we call them vectors, are they not really just points, in world space, unless of course the vector is coming from point 0 0. Please help if anyone has any insight.

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
03/17/2010 (8:15 am)
Hey Rennie,

I'm no math wizard but I think you're confusing a normal (which you seem to understand) and a normalized vector.
#2
03/17/2010 (9:51 am)
yes, so what is it in TGB?


t2dVectorNormalise(%vector)

and is it possible to calculate the angle precisely? But having said that, I am thinking for my game it is unnecessary now.



#3
03/17/2010 (1:22 pm)
Asking whether TGB does normals or normalized is a silly question as math is just math.

t2dVectorDot is just a function. If you pass in <x1,y1> and <x2,y2>, you get back x1 * x2 + y1 * y2, nothing more, nothing less. If the length of <x1,y1> is 1 and the length of <x2,y2> is 1 (both are normalized), then the dot product returns the cosine of the angle between the two vectors. This function is very useful and comes in handy in too many situations to count, which is why it is included as a function.

There is no built-in function to find you the perpendicular to a vector (at least that I can think of). It's a trivial calculation (<x,y> becomes <y,-x> or <-y,x>).
#4
03/18/2010 (8:45 am)
Yes I apologize, my cosine, angle etc skills are very rusty. I took algebra and calculus all thru high school but have not touched them since. I think I will look at iTunes U if I think I need to better understand this concept.



Thanks.