Thread: Orbiting camera around a point using quaternions

1. Orbiting camera around a point using quaternions

Hi Guys
I have the following code that successfully rotates the whole world around a given point in the space but I need the camera to orbit around the point instead of the world:

Camera::OrbitCamera(Vector3 point, float angle)
{
myCamQuaternion *= AxisAngleToQuaternion(myCamUpVector, angle);
myCamViewMatrix = myCamQuaternion.QuaternionToRotationMatrix();
glTranslatef(-point);
glMultMatrixf(myCamViewMatrix);
glTranslatef(point);
}

The modelview duality is still confusing, I want to see the world stationary and the camera orbiting instead of a stationary camera and rotating world.
thanks for help

2. Re: Orbiting camera around a point using quaternions

In your example is the use of quaternions pointless, just glRotate around the vector.

How was it in the Lou Reed tune...
He shaved his leg and then he was a she
Hey babe
talk a walk on the wide side
Doot, doo doot, doo doot, doo doot doo doot
Doot, doo doot, doo doot, doo doot doo doot...

3. Re: Orbiting camera around a point using quaternions

Originally posted by rh:
In your example is the use of quaternions pointless, just glRotate around the vector.

Sorry - I don't know much about quaternions really.

4. Re: Orbiting camera around a point using quaternions

excuse me ! who is Silvia , I did not get your point

5. Re: Orbiting camera around a point using quaternions

Let me introduce you to Silvia: http://www.opengl.org/discussion_boa...ML/014297.html
http://gamedev.net/community/forums/...opic_id=186925

Posting as Silvia instead of Mohammad may give more replies but asking "how do I move the camera instead of the world?" is confusing. Everything will of course be clear now when Orzech will post the definite answer.

6. Re: Orbiting camera around a point using quaternions

Dear RH

let me congratulate you on the sense of humor you have
and the way u try to detect things and link opengl.org with gamedev.net
but I think this time your analysis is not correct, may be I share with
Silvia the same stupid question but that does not mean I am Silvia, Any how
thanks for introducing Silvia to me, I hope will become three friends and if
that is not OK, at least on the technology level

7. Re: Orbiting camera around a point using quaternions

Hey RH and Moe

can you calarify to me what the hell is going on between u about me !!!

8. Re: Orbiting camera around a point using quaternions

Go for it Moe!
I am sure that you and Silvia will have a life long and close relationship filled with love.

May I also wish you all the best for the future and dont forget who introduced you to each other. Perhaps will it be a little rh in the future?

9. Re: Orbiting camera around a point using quaternions

Dear RH

I think it is the time to quit this funny game, I had an experience in hacking,
cracking, stealing passwords, faking IDs, spoofing, software exploits,
if you have heard about netbus, I developed my own spy software,
I had real fun in the early days of the internet but this time I did this just for fun
and I was aware that somebody (like you for example) might notice that mohammad_aburrub
and silvia_steven_200 are the same person. I did not forget the fact that both moe and
Silvia asked the same question simply because I do not care if this is revealed or not

why did I insist that they are two different people ? let me be honest with you:

1) I used a girl name: simply because girls attract everything
around and this idea worked and I got allot of replies, but believe me I
did it for fun at the first place because eventually I do not care if my
question is not solved, I can research more and more and find a solution,
I solved the problem myself and my camera class is fully working now.

2) why did not I tell you the truth at the beginning and let Silvia talk to me and you
do not go that far in thinking, I also loved to have some fun but in my mind I would
not like to keep it secret for ever but you detected that early (congratulations)

OpenGL.org is a serious place on the web, it is not a good idea to switch it
to a chat room. I am so sorry and I do apologize for every body in the
forum if that is offensive in a way

now if you do not mind, it is a great pleasure for me to be a friend of mine,
at least on the technical level

Origin Palestine
Currently work as QA Engineer at www.pdf.com - San Jose

10. Re: Orbiting camera around a point using quaternions

Great but are you not taking things a bit too serious? I would never waste time trying to find out if two posters are identical. I answered Silvias question and after that read the post from Mohammad. It was obvious from the same person.

Dont do the crime if you cant do the time.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•