I'm trying to make a rubber duck move along the surface of a round 'world' - I should be able to rotate the duck on it's local Y axis and then move the duck forward, with the duck following the surface of the world.
Effectively these are tank controls for a duck, on the surface of a sphere.
I'm able to spin the duck on it's Y axis when it's at the top or bottom of the world, then push it forward on the nested X axis.
The problem is that when the duck is away from the poles, pushing left and right cause the duck to orbit the world instead of turn on it's local Y axis (and then move forward (around the globe) relative to the duck).
I'm currently attempting to apply rotations to the duck before translating it with the code pictured, but I don't seem to have any change to my undesired behaviour... =/
BeginMode3D(camera);
DrawModel(world, worldPos, 1.0f, WHITE); // Draw world
rlPushMatrix(); // DUCK MATRIX Y
rlRotatef(duckOrbitRotationY, 0.0f, 1.0f, 0.0f);
// rlTranslatef(0.0f, 1.0f, 0.0f); // Swapped the order of the rotation, then translate
// rlPopMatrix();
rlPushMatrix(); // DUCK MATRIX X
rlRotatef(duckOrbitRotationX, 1.0f, 0.0f, 0.0f);
rlPushMatrix(); // DUCK MATRIX Z
rlTranslatef(0.0f, 1.0f, 0.0f);
//rlRotatef(duckOrbitRotationY, 0.0f, 1.0f, 0.0f);
// rlRotatef(duckOrbitRotationZ, 0.0f, 0.0f, 1.0f);
DrawModel(model, duckPos, 1.0f, WHITE); // Draw duck
rlPopMatrix();
rlPopMatrix();
rlPopMatrix(); // END DUCK MATRIX
