Advertisement

[NEWBIE] Quaternions: How to use them?

Started by January 13, 2001 04:15 AM
2 comments, last by Pure Krome 23 years, 10 months ago
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
-PK-
a little demo of quaternions in use is on my site under IIRC reflection mapping extension (or someit)

http://members.xoom.com/myBollux
Advertisement
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 sizevoid 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-
-PK-
Anyone????

*beg beg*

*had to respond to pump the topic back to the top > *

-PK-
-PK-

This topic is closed to new replies.

Advertisement