Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / [Help Needed] - Get Camera Top, and Front from Euler Angles

Author
Message
MikeRK
15
Years of Service
User Offline
Joined: 18th Aug 2010
Location: United Kingdom
Posted: 13th Sep 2010 13:11
(Sorry in advance if this is the wrong thread to post to)

Hey folks,

Problem:

To introduce myself, I'm very inexperienced in Quaternion Mathematics, and what I'm trying to do is, get the Top, and Front angles from a specified Euler Angle (i.e. Camera Angle). Reason for this is to apply the values to a 3D Sound Listener from a third party sound engine.

Restrictions:

I know of EZRotate, not to say I've had much experience with it (although I purchased it, I've never played around with it), but the code needs to be portable from DBPro to C++ to write it into a TPC plug-in, and as such no licensed plug-ins can be used.


Is Anyone So good with Quaternion maths, and matrices, that they would just love the opportunity to help?


Thanks Kindly

Mike,

p.s. Any and All help given will be acknowledged in the project this is being applied to.

Mikey

::Hybrid Two::Binary Zoo::RGT Veteran::
Diggsey
20
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
MikeRK
15
Years of Service
User Offline
Joined: 18th Aug 2010
Location: United Kingdom
Posted: 13th Sep 2010 20:38
I see the page, and my mind just blanks... I really must emphasise my lack of understanding of this subject.


If I had the 3 values from the X, Y and Z rotation of a Camera, what would be the algorithm I would use to calculate the 'Top' angle (i.e. from the nose to the top of the head), and the 'Front' angle (i.e. from the nose, to what you're looking at).... The exact same front and top angles required to place listeners in most 3D sound libraries (DirectSound, Bass, FMOD, etc.)

Mikey

::Hybrid Two::Binary Zoo::RGT Veteran::
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 14th Sep 2010 06:29
Well... first of all the camera's x,y, and z angles would be facing forward right? Something like this should work:



As far as a purely mathematical approach goes... it would be super super easy if you just needed up and forward vectors. Otherwise, the solution that comes to my mind (without thinking too much xD) is to build the object's rotation matrix, multiply that by a rotation about an axis and then get the euler angles from that matrix. That's pretty much what you're doing anyways, and I'm not sure if that would be slower (it might be, because they're math commands, but maybe not, because that's gotta be similar to what pitch object does).

Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 14th Sep 2010 12:27 Edited at: 14th Sep 2010 12:31
I strongly suggest to download the MatrixUtils from IanM in the DLL Talk board.

If you get it, you can easily get those vectors using:


[edit] Sorry I didn't notice that you weren't asking for vectors. But I'll leave it up here for reference.

Cheers!
Sven B

Login to post a reply

Server time is: 2026-07-22 12:59:04
Your offset time is: 2026-07-22 12:59:04