ofCamera orientation [solved]

Hi there, I want to set an ofCamera to be oriented orthogonally with the Y axis of a sphere the camera travels with. I have the camera “stuck” on the top of one sphere (mesh) while it rotates around an inner sphere:

I can’t get the camera to pitch properly (left/right and up/down) so it looks like the player is walking on the sphere, like a planet. Does anyone know how I would set the orientation to make that happen?

Thanks!

Any thoughts?

Basically I want it to work like this, if the ship were the camera: http://tinyshipping.librador.com/

In case anyone else runs into this problem, I solved it like this:

sp.rotate(handPos.z/1000, sp.getXAxis());
sp.rotate(-handPos.x/1000, sp.getZAxis());
    
ofMatrix4x4 transformer = sp.getLocalTransformMatrix();
transformer.setTranslation(sp.getUpDir()*sp.getRadius());
cam->setTransformMatrix(transformer);

where sp is an ofPrimitiveSphere, and handPos is leap motion coords