@ttyy wrote:
I'm trying to move a camera in an orbit around a point. I'm using the ofCamera::orbit() function to do this. But I can't seem to get it to work as expected.
Running the below code results in the camera sticking at position 0,0,500, never moving. My understanding is that the camera should be moving in a circle of radius 500, around the Y axis of ofVec3f(0,0,500). So the camera's X and Z coordinates should be changing all the time to make the circle....If I change the radius parameter of the orbit function to -500, however - I get exactly the behavior I describe above. Why is that? Am I misunderstanding the purpose of the orbit() function?
void ofApp::setup(){ cam.setPosition(0, 0, 0); } void ofApp::update(){ cam.orbit(ofGetElapsedTimef()*10, 0, 500, ofVec3f(0, 0, 500)); // long (degrees), lat, radius, center pt cam.lookAt(ofVec3f(0, 0, 500)); } void ofApp::draw(){ cam.begin(); cam.draw(); ofDrawBox(ofVec3f(0,0,500),100); cam.end(); }
Posts: 1
Participants: 1