Camera's up-vector y-coordinate may be signed incorrectly.

Started by paulscode, September 15, 2008, 06:03:35 AM

Previous topic - Next topic

paulscode

I noticed that returned vectors for the Camera's default orientation are:

getDirection() returns: (0, 0, 1)
getUpVector() returns: (0, 1, 0)

This should mean the camera is facing into the screen and upside down (since -y is "up" in jPCT).  I am not sure if this is a bug or not, but I thought I would bring it up just in case.  It seems possible that the returned y-coordinate for the camera's up-vector is signed incorrectly.  Reason I say that is because when converting the returned values for direction and up into OpenAL coordinates, sounds are playing backwards (i.e. coordinates for an Object3D to the left create sources to the right when the listener's orientation is synced with the camera).  This is what one would expect if the listener were facing the same direction but upside down in relation to the camera.  Of course the most likely cause for this odd behavior is a bug in my code and not a bug in jPCT, but it does seem possible that the camera's actual default up-vector is really (0,-1,0) and the method Camera.getUpVector() is somehow returning an incorrectly signed value for y.

EgonOlsen

Looks like a bug to me. I forgot to negate the vector taken from the rotation matrix. So it indeed represents the y-axis in camera space, but that's not really the up-vector. I'll fix it in the next release.

paulscode

Awesome.  For now I will just negate the value manually.  Thanks!