Advertisement Jump to content


This topic is now archived and is closed to further replies.


ModelView Matrix

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

Hi I'm making a tennis game. I am using an object hierarchy for the characters. So I have Body->Shoulder->Forearm->Racket. At the moment I'm using gluSphere for the ball. I've done collision detection on the player and ball with the world using Sphere Polygon collision. These were easy enough since I just get the player or ball position. Now I want collision with the racket face and the ball. It's gotten complicated because of the object hierarchy. I need to extrapolate the position of the limbs after movement. What I have done is call the collsion routine immediately when I draw the racket. I also extracted the modelview matrix: glPushMatrix(); glGetFloatv (GL_MODELVIEW_MATRIX, racketpos.Data); BallRacketCollision(racket.mesh, racket.numpolys); racket.Draw(); glPopMatrix(); Now I tested it by drawing another gluSphere(in the ballracketcollision function) and got it at the centre of the racket with a translation. It stays at the centre of hte racket even as the character, the arms and racket move in all directions. So the first step is just plain sphere sphere collision with this sphere and the ball. To do this I need the radiuses(which I have). The centre of the ball(I have this). The centre of the racket sphere(I don't have this ) So the question is how do I get this coordinate? I'm guessing I have to do some stuff with the modelview matrix, and perhaps the perspective matrix. Thanks in advance for your consideration [edited by - rugal on January 30, 2003 10:49:44 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!