How would I do this using matrix math?
Blitz3D Forums/Blitz3D Programming/How would I do this using matrix math?
| ||
I want to get the transformed position of the camera. (I'm removing the light position & rotation from the camera right?)lx#=EntityX#(light,1) ly#=EntityY#(light,1) lz#=EntityZ#(light,1) lpitch#=EntityPitch#(light,1) lyaw#=EntityYaw#(light,1) lroll#=EntityRoll#(light,1) camx#=EntityX#(cam,1) camy#=EntityY#(cam,1) camz#=EntityZ#(cam,1) cpitch#=EntityPitch#(cam,1) cyaw#=EntityYaw#(cam,1) croll#=EntityRoll#(cam,1) EntityParent cam,light,True PositionEntity light,0,0,0 RotateEntity light,0,0,0 ;Grab the cameras transformed matrix (GetMatElement..) GetEntityMat cmat,cam ;Unparent the camera, reposition cam & light EntityParent cam,0 ;put the light back where it was PositionEntity light,lx,ly,lz,1 RotateEntity light,lpitch,lyaw,lroll,1 PositionEntity cam,camx,camy,camz,1 RotateEntity cam,cpitch,cyaw,croll,1 |
| ||
Do you need the position of the camera relative to the light? tformpoint enityx( cam, 1 ), entityy( cam, 1 ) , entityz( cam , 1 ) , 0 , Light tformedx, y & z are the coords relative to the camera Probably barking up the wrong tree as I'm not sure what you mean. Apologies if that's the case. Stevie |