i want to adjust the wheel angle then move forward depending on angle
// Function to rotate the wheel to the left
static void rotateWheelLeft() {
if (deg < 45) {
deg += 2.0f;
}
}
// Function to rotate the wheel to the right
static void rotateWheelRight() {
if (deg > -45) {
deg -= 2.0f;
}
}
// Function to move the wheel forward based on its rotation angle
static void moveForward() {
GLfloat radianAngle = deg * 3.14 / 180;
GLfloat forwardX = 0.1f * cos(radianAngle);
GLfloat forwardZ = 0.1f * sin(radianAngle);
xWheel -= forwardX;
zWheel += forwardZ;
}
// Function to draw the bicycle
static void drawBicycle() {
glPushMatrix();
glTranslatef(xWheel, yWheel, zWheel);
glRotatef(deg, 0, 1, 0);
glTranslatef(-xWheel, -yWheel, -zWheel);
drawOuterWheel(0.1, wheelColor);
drawInnerWheel(0.08, wheelColor);
glPopMatrix();
}
The wheel rotated correctly but when i move forward the wheel moves in a line