Jump to content
  • Advertisement
Sign in to follow this  
Kalisto

having a problem rotate my car

This topic is 3645 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 is my matrix that is build so its would rotate my car, (in case the user want to turn the car right or left) float rotateY[4][4]={{cosa, 0, -sina, 0}, {0, 1, 0, 0}, {sina, 0, cosa, 0}, {0, 0, 0, 1}}; and this is how I thought to rotate my car: case 'l': oldVx=car_move[3][0]; oldVy=car_move[3][1]; oldVz=car_move[3][2]; matMult(car_move,rotateY,temp); break; If the user press l,the program will save the old values of "car_move"(X,Y,Z) matrix, and then multiplay it like this: car_move*rotate=temp and then I will put the X,Y,Z values of the car back. temp[3][0]=oldVx; temp[3][1]=oldVy; temp[3][2]=oldVz; then I will take my prototapy of the car,and multiplay it by the temp.. and then I will draw the world. the prototapy of the car: float mCar[4][4]={{1, 0, 0, 0}, {0, -1, 0, 0}, {0, 0, 1, 0}, {5, 10, 50, 1}}; ----- the problem is that the body dose not rotating,its moving in a little angle to the righ...any idia why?

Share this post


Link to post
Share on other sites
Advertisement
to be honest, I have no ~~~~ idea about what you mean ~~

what is car_move for? and temp? It seems that only car_move [3] and temp[3] are used.

Share this post


Link to post
Share on other sites
Ehh, that makes no sense to me either lol. Why can't you just use a rotX, rotY, and rotZ to hold it's rotation and glRotate, then draw it? If not, implementing a physics engine will save you loads of time and work and will result in more realistic effects probably. I recently implemented PhysX into my project without problems and it works great.

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.

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

Sign me up!