How to use ofxCamera.orbitAround

I’ve been having trouble trying to get the orbitAround function of ofxCamera (in the ofx3DUtils addon) to work. I’m not sure what the parameters need to be as there is no documentation for it. Has anyone successfully used it? I have my camera a {0, 0, 500} and I want to orbit around {0, 0, 0} at a distance of 500? The signiture of the method is orbitAround(ofxVec3f target, ofxVec3f axis, float angle). The angle parameter is obvious enough, but I’m not sure what the other two parameters are supposed to be. My first thought was that target should be {0, 0, 0} and axis should be {1, 0, 0} but that doesn’t do what I expect.

Thanks in advance for your help.

Without being able to run this at work right now my semi-educated guess is that target is what you want to be orbiting around and axis is the axis you want to orbit on, i.e. the y-axis orbits as though I’m standing still and you’re walking around me. The angle is where in the arc around me you want to be standing in degrees.

Thanks Joshua. What you described is what I was doing but it doesn’t quite work. It seems to work fine for the first half of my orbit, but after traveling 181 degrees the image I see of you suddenly flips direction so you’re facing backwards. Here’s an illustration of what I’m seeing:

at 0 degrees rotation:

you–>

me

at 90 degrees rotation:

you–> me


at 180 degrees rotation:

me

you -->

at 181 degrees rotation:

me

<–you

I’m not sure if I’m using the library incorrectly or if this is something I’m supposed to account for in my code.

Thanks for any advice you can give me.

Should the axis be: {0, 1, 0}?

I finally figured out what this is. The problem is with my up vector. When I thought about what happens to a camera as it rotates around an object it became obvious. At 180 degrees the camera is upside down. So if I reverse the up vector of the camera at that point, I don’t see the image flip. I wasn’t thinking :?