# having a problem rotate my car

This topic is 3818 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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 on other sites
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 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.

1. 1
2. 2
3. 3
Rutin
16
4. 4
5. 5

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633723
• Total Posts
3013546
×