Hi I’m trying to animate a bicycle wheel’s movement. the wheel can turn its direction, however the direction is always relative to the origin of the room and not the wheel. How can I adjust the direction so that the wheel moves straight at a new angle relative to itself?
heres my movement function which works when the turning angle is 0:
glTranslatef(-cos((double)((turn_angle)*PI/180))*speed, 0, sin((double)((turn_angle)*PI/180))*speed);
thanks in advance
Hrmm, a lone bicycle wheel in a room? No bike? What’s the coordinate system of the room and the bike? I’m not sure what you mean with directions and relative angles. You want to specify the vertical rotation of the wheel or the axial rotation of the wheel?
If you’re just moving the wheel around the room, that’s the translation. If you want to spin it vertically so it’s “facing” where it is traveling, that’s the rotation. Is it also spinning as it’s moving? That would be another rotation. Is the wheel “leaning” when it makes a turn? That would be a third rotation.