PDA

View Full Version : Orbiting camera around a point using quaternions

10-18-2003, 07:27 PM
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

10-21-2003, 06:54 PM
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...

Orzech
10-22-2003, 01:11 AM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

10-22-2003, 08:19 AM
excuse me ! who is Silvia , I did not get your point

10-22-2003, 11:43 PM
Let me introduce you to Silvia: http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/014297.html
http://gamedev.net/community/forums/topic.asp?topic_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.

10-23-2003, 08:06 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

silvia_steven_2000
10-23-2003, 08:09 AM
Hey RH and Moe

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

10-23-2003, 10:18 PM
Go for it Moe!
I am sure that you and Silvia will have a life long and close relationship filled with love. http://www.opengl.org/discussion_boards/ubb/smile.gif

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? http://www.opengl.org/discussion_boards/ubb/smile.gif

silvia_steven_2000
10-24-2003, 09:03 AM
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