Jump to content
• ### What is your GameDev Story?

• Advertisement

Public Group

# Get Coordinates After Rotating the axis

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

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

#### Share this post

##### Share on other sites
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.)

#### Share this post

##### Share on other sites
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.

#### Share this post

##### Share on other sites
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

#### Share this post

##### Share on other sites

• Advertisement
• Advertisement
• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

(You must login to your GameDev.net account.)

• ### Popular Now

• 15
• 9
• 11
• 9
• 9
• Advertisement
• ### Forum Statistics

• Total Topics
634133
• Total Posts
3015748
×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!