Get Coordinates After Rotating the axis

Started by
2 comments, last by Joran 18 years, 10 months ago
Euh, i am trying to learn opengl and so far it has been pretty good, but i have a question and i am sure this question is asked a million times but i can't seem to get to find the thread so i will ask my question. Purpose of question : I have written a class that detectscollitions by doing cube collitions so each object cube, polygon aso is beeing converted in a cube so i only have to do cube checks, but if i change my axis my objects is drawn and moved ofcourse, but my coordinates are not updated so it is like i never moved my object at all because my class still holds the information bottomleft,bottomright,enz... instead of bottomleft with z -5, bottomright z - 5, aso. Example will make this clear. Sorry if you dont understand what i mean my english is good when i need to speak it but writting is difficult. Let say, i have a quad, 1 to be exact, vertex coordinates translate z-axis -5 bottomleft(-0.5,-0.5,0.0) bottomright(0.5,-0.5,0.0) topright(0.5,0.5,0.0) topleft(-0.5,0.5,0.0) this is a normal quad drawn counterclockwise with -5 on the z axis so infact if i take my orginal axis my coordinates would look like these. bottomleft(-0.5,-0.5,-5) bottomright(0.5,-0.5,-5) topright(0.5,0.5,-5) topleft(-0.5,0.5,-5) That is simple but what if i began to rotate my axis how would i be able to find my new coordinates based on my orginal axis (0,0,0) without any rotations, translations aso. I have changed my axis and then draw my quad, but i need to figure out what my coordinates would be in relation to the axis (0,0,0). Thx
Advertisement
You will probably have to transform the coordinates yourself, either with a matrix retrieved from OpenGL via glGetFloat(), or by creating or maintaining the matrix yourself. If you already know matrix/vector math, it'll just be a matter of implementation. Otherwise, check out the math tutorials in the 'articles' section here.

(I'm not aware of any OpenGL functionality for retrieving transformed geometry, but that doesn't mean there isn't such a thing.)
The collision system will need to keep track of the location and orientation of the bounding boxes ("cubes", as you call them). OpenGL is for graphics and trying to use it to implement collision detection is not going to work very well.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
I thank you both for you suggestions on that matter, and for taking the time to read it, but i want to say i dont want to use opengl as collition detection program i am just trying to get a 3d object to move and another 3d object to move as well and to see if the intersect somewhere with the other object (collition detection). But as you thought i am not trying to use opengl for a collition detection program on other win32 api's who dont uses opengl to render graphics.

Thanks anyway i will try to do the math

This topic is closed to new replies.

Advertisement