Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Pure Krome

[NEWBIE] Quaternions: How to use them?

This topic is 6336 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

G'day. If i know my X|Y|Z co-ords AND i have a QUATERNION which i suppose will hold my DIRECTION, how do i use both these to SHOW WHERE I AM / WHAT I'M LOOKING AT in OpenGL? gluLookAt? or does glMultMatrixd re-display the co-ords... How please... thank you kindly for any help. -PK- Edited by - Pure Krome on January 13, 2001 5:46:53 AM

Share this post


Link to post
Share on other sites
Advertisement
a little demo of quaternions in use is on my site under IIRC reflection mapping extension (or someit)

http://members.xoom.com/myBollux

Share this post


Link to post
Share on other sites
Hmm.. weird..

I have my quats working now...

but it''s not doing EXACTLY what i want..

if i click LEFT once, i start YAWING to the left at a RATE. If I leave my hand on the button, i YAW LEFT at that constant RATE.

so far so good.

if i release the key, i stop yawing. if i hit (and keep pressed, like normal) LEFT again, i YAW LEFT at 2x my previous RATE.

i release the key and stop yawing.

NOW, if i hit the RIGHT YAW BUTTON (keep pressed), i go LEFT at the original rate (half the previous rate). If i hit right again (keypress number 2), nothing happens, if i hit right (3rd time), i start yawing RIGHT at a constant RATE. if i hit right (4th), then it''s RIGHT YAW 2x constant RATE.

etc..

-WHY- ??

code..


...
#define MOVEMENT_YAW_SIZE 0.01 // Turn size

void Camera::YawLeft() {
Quaternion q;

q.EulerToQuat(0, MOVEMENT_YAW_SIZE,0);
IsOrientating(true);
Orientation *= q;
}

void Camera::YawRight() {
Quaternion q;

q.EulerToQuat(0,-MOVEMENT_YAW_SIZE,0);
IsOrientating(true);
Orientation *= q;
}


void RenderScene(void)
{

if (camera.IsOrientating() == true)
camera.Orientate();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer

...


-PK-

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!