Jump to content
  • Advertisement
Sign in to follow this  
nman2084

glmultmatrix question car model

This topic is 2776 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:

glPushMatrix()

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)))


glPopMatrix()


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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!