Jump to content
  • Advertisement
Sign in to follow this  

glmultmatrix question car model

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

This the way i took in trying to make the front tire rotate when the car moves forward. I first calculated the center of the car:

Then center of car tire:

in Draw function, i am trying to do multmatrix:


A = self.matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, self.carCenterX - self.xtireCenter, self.carCenterY - self.ytireCenter, self.carCenterZ - self.ztireCenter, 1)

glMultMatrixd(cast(A, POINTER(c_double)))

B = self.matrix(1,0,0,0,0, math.cos(math.radians(self.angle1 + 45)), math.sin(math.radians(self.angle1 + 45)), 0, 0, -math.sin(math.radians(self.angle1 + 45)), math.cos(math.radians(self.angle1 + 45)), 0, 0, 0, 0, 1)

glMultMatrixd(cast(B, POINTER(c_double)))

draw the tire

C = self.matrix(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, self.xtireCenter - self.carCenterX , self.ytireCenter - self.carCenterY, self.ztireCenter - self.carCenterZ, 1)

glMultMatrixd(cast(C, POINTER(c_double)))


Basically i am translating the center of tire to center of the car, rotate the tire and then translating back where tire was originally.

But this seems to be not working.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!