Main Page   Modules   Alphabetical List   Data Structures   Data Fields  

Adding Position Reporting Code
[Tutorial 3 - User Interaction 2]

Next we will learn an important lesson about coordinate space in RenderWare Graphics. The code will be extended to report the position of the picked atomic. As we drag the atomic in world space we will get feedback telling us where the atomic is.

  1. The camera is located at the origin of the world; the cube created by pressing the F1 key is located 5 units in front of the camera, i.e. at (0.0, 0.0, 5.0).
  2. The z-axis for the world co-ordinate system increases in the direction the camera is looking (such that there is a correspondence between the z co-ordinate and depth). In our tutorial the unit cube is offset 5 units from the camera (at 0.0, 0.0, 5.0) and so is at a depth of 5.
  3. RenderWare Graphics uses a right-handed co-ordinate system. Therefore with z increasing into the display screen, and y increasing upwards, the x co-ordinate system increases towards the left.
Note:
This co-ordinate system may be different from what you are used to. The following picture illustrates the RenderWare Graphics world co-ordinate system. Using RenderWare Graphics terminology this picture says that the default orientation of the camera aligns the camera's at vector with the world z-axis, and the camera's up axis with the world y-axis.
Screen coordinates

You might wonder why matrices in RenderWare Graphics use a vector called "right" which in this illustration points towards the left of the screen. This often is a cause of concern. To resolve this, imagine that you can fly into the computer monitor and look back towards the screen. In this situation you will have the axis labeled "x" in the diagram above pointing towards the right, and the "z" axis will be pointing "at" you. We have not modified the coordinate system, but by changing our position we have resolved the names of the vectors in the matrices that RenderWare Graphics uses.

Next...


Criterion Software © 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:46:58 2004. Send Feedback