Jump to content
  • Advertisement


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


Initial orientation/rotation

This topic is 6267 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

If an object is centered at [0, 0, 0], but no orientation is provided, what "direction" are they facing? Is this indeterminate? Is there a default "assumed" direction? Also what should an orientation be stored as internally? A matrix? Quaternion? Vector? Other? Thanks!

Share this post

Link to post
Share on other sites
It all depends!
In Open GL, the initial orientation is :
z is into the screen,
x is left right, and y is up and down!

The most used are the left_hand system, and the righthand system. as used by OpenGL.

If you only have [0,0,0] there are no orientation! If this is a vector, its directed nowhere! (or maybe at itselfe)
If you add a camera, to viewe you orientation, the camera will add some orientation, and therfor it will be oriented!

You may do this whatewer you want!
If your talking about 3D world programming, you can use a orientation [x,y,z] and a direction [turn,pitch,rol] on the camera and ewery objekt! this is enough to create a full world, but you need to define where direction[0,0,0] points, and what way the object/camera rotates when any of the 3 angles increase.....

All the 3D APIs, have their own system, you can use theires, or create you own, if so you need to learn 3D math

my myselfe use a 3 dim vector for position, a 3x3 matrix for orientation, witch i calculate with 3 angles!

Share this post

Link to post
Share on other sites
Ah! OK that helps a fair bit thanks!

I''m trying to do my own 3D system (yes learning Matrix math etc and have currently defined orientation using a 3x3 matrix. So my next question I guess is: assuming my object is "facing" along the positive x-axis, and I''m using a left-handed system, what will my 3x3 matrix contain? That''s the bit that is confusing me... will it be something like:

|1 0 0|
|0 0 0|
|0 0 0|



Share this post

Link to post
Share on other sites
What you're talking about here is called "Orthogonal Basis Vectors" Meaning they have to be at right angles, and unit vectors, and along with the position define a particular reference frame.

Generally this looks like

|Rx Ry Rz 0|
|Ux Uy Uz 0|
|Dx Dy Dz 0|
|Px Py Pz 1|

R = right U = up D = direction P = position

Looking at the identity matrix, it's easy to see now that it defines the standard coordinate system..

Right = 1,0,0
Up = 0,1,0
Direction = 0,0,1
Position = 0,0,0

When you rotate one of the vectors, the rest of them rotate too, unless you're rotating around one of the orientation vectors themselves, which would mean only two of them would rotate. So if you pointed the Direction at the X axis, you have to rotate the Right vector along with the direction, so they remain orthogonal..

Orientation pointing in the X direction..

| 0 0 -1 0|
| 0 1 0 0|
| 1 0 0 0|
| 0 0 0 1|

As you can see, the Up vector didn't change, but the Right vector is now pointing at -Z axis.


Edited by - bpj1138 on September 25, 2001 9:40:56 AM

Share this post

Link to post
Share on other sites
Actually, uncutno''s answer isn''t complete, and there''s a slight error/miscommunication.

The left-handed coordinate system uncutno refered to is the *camera* coordinate system. The *model* coordinate system----which is the coordinate system you define your model in----is a right-handed system.

From the OpenGL Red Book, the default orientation is positive x to the right, positive y up, positive z *out* of the screen. This is a right-handed coordinate system. You can always tell if a system is right handed if the cross product of the x axis with the y axis points in the positive z axis. (Actually, any permutation of xyz works. x cross y = +z, y cross z = +x, z cross x = +y.)

The camera by default looks down the negative z axis. If you move the camera along the positive z axis without changing its orientation, you will be able to see the origin of the world. The camera retains positive x to the right and positive y up. The camera''s local z axis is just considered to be in the negative world z direction because objects have to move along the negative world z to be in front of the camera. You can consider camera z to be negative world z. And so camera x cross camera y = negative camera z----a right-handed system.

Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!