I transform the "camera across" and "camera down" vectors into global space like this:
TFormVector -1,0,0,cam,0
camxx#=TFormedX()
camxy#=TFormedY()
camxz#=TFormedZ()
TFormVector 0,-1,0,cam,0
camyx#=TFormedX()
camyy#=TFormedY()
camyz#=TFormedZ()
and then position of the four corners of my quad using the following, first vertex is center+up+left, second if center+up+right etc
x#=p\x-cyx+cxx
y#=p\y-cyy+cxy
z#=p\z-cyz+cxz
VertexCoords surf,i,x,y,z
x#=p\x-cyx-cxx
y#=p\y-cyy-cxy
z#=p\z-cyz-cxz
VertexCoords surf,i+1,x,y,z
x#=p\x+cyx-cxx
y#=p\y+cyy-cxy
z#=p\z+cyz-cxz
VertexCoords surf,i+2,x,y,z
x#=p\x+cyx+cxx
y#=p\y+cyy+cxy
z#=p\z+cyz+cxz
VertexCoords surf,i+3,x,y,z
taken from http://www.blitzbasic.com/codearcs/codearcs.php?code=437
|