View Full Version : World coordinates

fortikur

12-21-2002, 06:13 AM

I have a cube that I move with glTranslate() and glRotate(). It starts its movement from 0,0,0 in the word coord system.

How can I know where it is in the world coordinate system (X,Y,Z coords)?

I mean is there a possibility to calculate the new coordinates according to the world coord system without calculating degrees, using pow() and CPU slowing stuff like that?

nexusone

12-21-2002, 12:08 PM

You can use a variables cube_x, cube_y, cube_z and your cube will be drawn where ever you want by changing the variables.

If you are moving in straight lines, then simple vector math will work. a google search will turn up ton's of examples.

But if your object is moving in a arc, then you will need to use a little math sin/cos to find the current x,y,z.

Originally posted by fortikur:

I have a cube that I move with glTranslate() and glRotate(). It starts its movement from 0,0,0 in the word coord system.

How can I know where it is in the world coordinate system (X,Y,Z coords)?

I mean is there a possibility to calculate the new coordinates according to the world coord system without calculating degrees, using pow() and CPU slowing stuff like that?

Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.