Creating a lookAt matrix..
Posted: Mon 20. Sep 2010, 22:39
I was wondering if there was any built in means of creating a lookAt matrix other than the P3 provided one. Right now I currently use:
But unfortunately the up vector gets thrown off and my scene is rotated undesirably. I have also used MatrixBuilder to translate/rotate the camera but have achieved the same result.
I have also tried using some directX code I had to manually calculate the matrix myself, but this has not worked as the scene fails to render properly (I have to use encompass() to get it back to displaying properly, but that moves the camera).
Is there an easy way to tell P3 or a something else the desired up vector for a lookAt matrix? If not I will need to hard code the "Roll" value in P3.makeLookatMatrix() for now.
Any help is greatly appreciated!
Code: Select all
cameraNode.getTransformation().setMatrix(Rn.inverse(null, P3.makeLookatMatrix(null, pos, loc, 0.0, Pn.EUCLIDEAN)));
I have also tried using some directX code I had to manually calculate the matrix myself, but this has not worked as the scene fails to render properly (I have to use encompass() to get it back to displaying properly, but that moves the camera).
Is there an easy way to tell P3 or a something else the desired up vector for a lookAt matrix? If not I will need to hard code the "Roll" value in P3.makeLookatMatrix() for now.
Any help is greatly appreciated!