Jump to content
  • Advertisement
Sign in to follow this  
Godden

OpenGL finding cordinates after rotation

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

Hey, Im working on a very simple assignment, where i need to detect collision detection of a ball within a cube. the cube i have rotates around the x and y axis. To be able to do the collision detection i need to know were points are located so i can find the distance from the ball to the cube. Is there someting i can call to find out the points of the cube thanks. Or have you any other ideas on how to tackle this thanks Btw i wasnt 100% sure this should go here or in the maths, but i gathered there must be some method call form openGL to help me thanks

Share this post


Link to post
Share on other sites
Advertisement
when u know the object coordinate of your ball/cube you can simply multiply it with the Model Matrix.

I just had the same problem where I wanted to know the world coordinate of my object in my vertex shader. I ended up passing the model matrix to the shader and multiply it with the vertex.

gllpushMatrix;
glLoadIdentity;
// do whatever translation/ rotation you want
getfloatv( ModelViewMatrix, @M ); (don't know the exact call)

M * Vertex = the global position of your cube vertex you
probably want

glPopMatrix;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

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!