Author Topic: Camera's up-vector y-coordinate may be signed incorrectly.  (Read 6866 times)

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Camera's up-vector y-coordinate may be signed incorrectly.
« on: September 15, 2008, 06:03:35 am »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Camera's up-vector y-coordinate may be signed incorrectly.
« Reply #1 on: September 15, 2008, 09:27:34 am »
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.

Offline paulscode

  • double
  • *****
  • Posts: 863
    • View Profile
    • PaulsCode.Com
Re: Camera's up-vector y-coordinate may be signed incorrectly.
« Reply #2 on: September 15, 2008, 01:19:47 pm »
Awesome.  For now I will just negate the value manually.  Thanks!