Vectors, Normals?

Blitz3D Forums/Blitz3D Beginners Area/Vectors, Normals?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

A vector is something which describes a direction and/or magnitude/speed.

Vectors are normally 2D 'x,y' or 3d 'x,y,z'.

The relative values of the x y and z components tell you which direction the vector is pointing in.

The absolute values of the x y and z components tell you the magnitude of the vector, how far or how fast in that direction?

So for example a vector of 1,1,1 means x+1,y+1,z+1.

A vector of 2,2,2 points in the same direction as 1,1,1 because the relative values are the same ( they are all equal ) but it is twice as large, so it would mean a movement twice as far or twice as fast.

A normal is 'usually' a 3D vector which describes the direction a triangle is facing and this is used to calculate how the face should be lit by hardware lighting or other lighting methods...in this case you are not interested in the magnitude of the vector, just its direction.

CollisionNX() etc. can be used to tell you the angle of the triangle that was involved in the collision.

You can use this to decide how to react to the collision, e.g. to bounce away from the collision by using the NX() NY() NZ() values to change the direction of whichever entity was invloved in the collision.

The list of what you can use the CollisionNX() etc. values for is endless and depends upon your specific needs.