How to know if a triangle is facing the camera?

Blitz3D Forums/Blitz3D Programming/How to know if a triangle is facing the camera?

This should work ..

;get cameras direction normal
Tformnormal 0,0,1,Camera, 0
CamNx# = tformedx()
CamNy# = tformedy()
CamNz# = tformedz()

;compute dot product of camera normal and tri normal
CdotN# = CamNx*TriNx + CamNY * TriNy + CamNz * TriNz
If CdotN < 0 then
  {This tri is facing the camera}
Endif


I forget whether the CdotN should be < 0 or greater so bear that in mind if it doesn't work as is.

Stevie