Game Development Community

Definition of cardinal directions

by Isidoros · in Torque Game Engine · 01/12/2010 (10:59 am) · 3 replies

Studying the "Advanced 3D Game Programming All in One", I have noticed that the definition of cardinal directions is:
$cardinalDirection[0]="0 10000 0";		//N
$cardinalDirection[1]="6000 6000 0";	//NE
$cardinalDirection[2]="10000 0 0";		//E
$cardinalDirection[3]="6000 -6000 0";	//SE

Can we use an alternative definition such as:
$cardinalDirection[0]="0 2000 0";		//N
$cardinalDirection[1]="2000 2000 0";	//NE
....

#1
01/12/2010 (1:28 pm)
I have no idea what these are used for but most likely they are supposed to be vectors. Otherwise I have no idea what the scale would be used for and what I am going to suggest will not work.

In the case they are vectors, I think both definitions are overly complicated. Something that is easier to see what's going on just by looking at it:
$cardinalDirection[0]=VectorNormalize("0 1 0");   //N  
$cardinalDirection[1]=VectorNormalize("1 1 0");   //NE  
$cardinalDirection[2]=VectorNormalize("1 0 0");   //E  
$cardinalDirection[3]=VectorNormalize("1 -1 0");  //SE
#2
01/12/2010 (2:10 pm)
Yes, it is used as arg in setAimLocation(). I can't find a reason not to use your definition.
#3
01/12/2010 (7:20 pm)
If it's being used in setAimLocation, then you'd probably want to use the large-scaled vectors. Otherwise, all bots will aim at a spot within one metre of the world origin, whether you tell them to aim north, south, east or west.

In answer to your original question, you can certainly use whatever vectors you like to define your compass points - as long as they're at the right angles to each other and so on.