My code sucks.
Okay...
You have a face of an object, defined as nx,ny,nz,d. You have a point on that face, defined as x,y,z.
The way I did this in Blitz 3D was to create a pivot, point it at the point nx,ny,nz with Chroma's point function (or pointing at another pivot works, too). I found I then had to rotate the entity to its own pitch, its own yaw, and a roll of 0.
I then Tformed the point x,y,z from world space to the pivot's space. TFormedX() supplied the U coordinate, and TFormedY() supplied the V coordinate. TFormedZ() was never used.
I have matrix routines that have been shown to produce the same results as Blitz3D transformations, but I am not very comfortable with them, and would prefer something simpler.
Okay...
You have a face of an object, defined as nx,ny,nz,d. You have a point on that face, defined as x,y,z.
The way I did this in Blitz 3D was to create a pivot, point it at the point nx,ny,nz with Chroma's point function (or pointing at another pivot works, too). I found I then had to rotate the entity to its own pitch, its own yaw, and a roll of 0.
I then Tformed the point x,y,z from world space to the pivot's space. TFormedX() supplied the U coordinate, and TFormedY() supplied the V coordinate. TFormedZ() was never used.
I have matrix routines that have been shown to produce the same results as Blitz3D transformations, but I am not very comfortable with them, and would prefer something simpler.