Walking on a sphere

hi all,

i did some games where you are walking around a map.
but the map was always somehow flat + some ups and downs.

but now i started to think about walking on a sphere and my head starts to burn…
i can´t even get the right idea how to start.

for the flat land i normally do:

//walking forward
    yrotrad = (yrot / 180 * 3.141592654f);
    xrotrad = (xrot / 180 * 3.141592654f);
    xpos += float(sin(yrotrad))/8 ;
    zpos -= float(cos(yrotrad))/8 ;

/// camera looking ahead
    if( xrot > 90 ) xrot = 90;
    if( xrot < -90 ) xrot = -90;

    yrotrad = (yrot / 180 * 3.141592654f);
    xrotrad = (xrot / 180 * 3.141592654f);

    gluLookAt(  xpos, ypos, zpos,
                xpos+float(sin(yrotrad)*1.0), ypos-float(sin(xrotrad)*1.0)*yMultiplyer, zpos-float(cos(yrotrad)*1.0), 
                0.0, 1.0, 0.0 );

but how would i need to do this for wlaking on a shpere ??


Movement is always projected along a straight line, flat or curved.
I would calculate the tangent at the current position and move along that.
If you’re jumping on a sphere, use a gravity vector pointed toward the center of the sphere to push you down.
Since you’re moving on a sphere, the gravity vector will need to be updated every frame.
And restrict your position to the radius of the sphere if falling below it.