On Sun, 2009-11-01 at 18:28 +0100, Erik Hofman wrote:
> At this time I've tried about everything to get the listener orientation 
> aligned properly. What's needed it converting the ViewOrientation matrix 
> (quaternation) and/or ViewOrientationOffset matrix (quaternation) to 
> align with OpenGL and get the look-at and look-up vector from it.
> the look-at vector should match the OpenGL view vector and the up-vector 
> is the perpendicular vector pointing out of the top of the listeners head.
> 
> It looks like I'm really close (for testing I've commented out some 
> position offset and velocity vector code) but to me it's not yet 100% 
> right, as if I'm missing something. I would really appreciate it if 
> someone who knows his way around this could take a look at 
> SGSoundManager::update_pos_and_orientation() in 
> SimGear/simgear/sound/soundmgr_openal.cxx
> View related values are set in FlightGear/src/Main/viewmgr.cxx: both 
> recalcLookFrom() anf recalcLookAt()
> 
> Erik

Erik,

I'm not good at this stuff at all, but I just remembered that the mpmap
code recovers yaw, pitch and roll from the quaternion passed in the
multiplayer message...  Is that what you need?  Or is that where you
started from?

http://pigeond.net/git/?p=flightgear/fgmap.git;a=blob;f=src/fg_server_xml.cxx;hb=HEAD#l85

  85 static void
  86 euler_get(float lat, float lon, float ox, float oy, float oz,
  87         float *heading, float *pitch, float *roll)
  88 {
  89     /* FGMultiplayMgr::ProcessPosMsg */
  90 
  91     SGVec3f angleAxis;
  92     angleAxis(0) = ox;
  93     angleAxis(1) = oy;
  94     angleAxis(2) = oz;
  95 
  96     SGQuatf ecOrient;
  97     ecOrient = SGQuatf::fromAngleAxis(angleAxis);
  98 
  99     /* FGAIMultiplayer::update */
 100 
 101     float lat_rad, lon_rad;
 102     lat_rad = lat * SGD_DEGREES_TO_RADIANS;
 103     lon_rad = lon * SGD_DEGREES_TO_RADIANS;
 104 
 105     SGQuatf qEc2Hl = SGQuatf::fromLonLatRad(lon_rad, lat_rad);
 106 
 107     SGQuatf hlOr = conj(qEc2Hl) * ecOrient;
 108 
 109     float hDeg, pDeg, rDeg;
 110     hlOr.getEulerDeg(hDeg, pDeg, rDeg);
 111 
 112     if(heading)
 113         *heading = hDeg;
 114     if(pitch)
 115         *pitch = pDeg;
 116     if(roll)
 117         *roll = rDeg;
 118 
 119 }


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to