Dx7 VB6
VB Code:
'Calculate Normals ' subtract point2 - point1 to find a vector ' no light, trying new method of point3 - point2 DataVector2.X = PointX(3) - PointX(2) DataVector2.Y = PointY(3) - PointY(2) DataVector2.Z = PointZ(3) - PointZ(2) 'subtract point3 - point1 to find another vector DataVector3.X = PointX(2) - PointX(1) DataVector3.Y = PointY(2) - PointY(1) DataVector3.Z = PointZ(2) - PointZ(1) ' find vector cross product and store in DV1 DataVector1.X = (DataVector2.Y * DataVector3.Z) - (DataVector2.Z * DataVector1.Y) DataVector1.Y = (DataVector2.Z * DataVector3.X) - (DataVector2.X * DataVector1.Z) DataVector1.Z = (DataVector2.X * DataVector3.Y) - (DataVector2.Y * DataVector1.X) ' normalize vector for light Dx.VectorNormalize DataVector1
when i run the program, and i check for the normal of the surface i collide with, i get this in my debug:
Impacted Normal----
-1.#IND
-1.#IND
-1.#IND
it doesn't matter what direction the normal is facing.
i need normals here, not because i'm working with light, but
because i'm working with collisions. it'll help me figure out the sliding.
Am i not doing something wrong?




Reply With Quote