{"action":"created","issue":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/4625","labels_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/4625/labels{/name}","comments_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/4625/comments","events_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/4625/events","html_url":"https://github.com/openframeworks/openFrameworks/pull/4625","id":118882031,"number":4625,"title":"ofNode: better default for up vector on lookAt. Closes #4594","user":{"login":"arturoc","id":48240,"avatar_url":"https://avatars.githubusercontent.com/u/48240?v=3","gravatar_id":"","url":"https://api.github.com/users/arturoc","html_url":"https://github.com/arturoc","followers_url":"https://api.github.com/users/arturoc/followers","following_url":"https://api.github.com/users/arturoc/following{/other_user}","gists_url":"https://api.github.com/users/arturoc/gists{/gist_id}","starred_url":"https://api.github.com/users/arturoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arturoc/subscriptions","organizations_url":"https://api.github.com/users/arturoc/orgs","repos_url":"https://api.github.com/users/arturoc/repos","events_url":"https://api.github.com/users/arturoc/events{/privacy}","received_events_url":"https://api.github.com/users/arturoc/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-11-25T17:08:11Z","updated_at":"2015-11-26T08:20:58Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/pulls/4625","html_url":"https://github.com/openframeworks/openFrameworks/pull/4625","diff_url":"https://github.com/openframeworks/openFrameworks/pull/4625.diff","patch_url":"https://github.com/openframeworks/openFrameworks/pull/4625.patch"},"body":"Instead of using {0,1,0} get's the vector of the camera position to\r\nthe lookAt point. then figures out the rotation that transforms {0,0,1}\r\ninto that vector and rotates {0,1,0} by that rotation to get the up vector."},"comment":{"url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/comments/159844982","html_url":"https://github.com/openframeworks/openFrameworks/pull/4625#issuecomment-159844982","issue_url":"https://api.github.com/repos/openframeworks/openFrameworks/issues/4625","id":159844982,"user":{"login":"arturoc","id":48240,"avatar_url":"https://avatars.githubusercontent.com/u/48240?v=3","gravatar_id":"","url":"https://api.github.com/users/arturoc","html_url":"https://github.com/arturoc","followers_url":"https://api.github.com/users/arturoc/followers","following_url":"https://api.github.com/users/arturoc/following{/other_user}","gists_url":"https://api.github.com/users/arturoc/gists{/gist_id}","starred_url":"https://api.github.com/users/arturoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arturoc/subscriptions","organizations_url":"https://api.github.com/users/arturoc/orgs","repos_url":"https://api.github.com/users/arturoc/repos","events_url":"https://api.github.com/users/arturoc/events{/privacy}","received_events_url":"https://api.github.com/users/arturoc/received_events","type":"User","site_admin":false},"created_at":"2015-11-26T08:20:58Z","updated_at":"2015-11-26T08:20:58Z","body":"i think that should work in all cases, i'm figuring out the longitude and latitude and from that creating the same quaternion we are using to orbit, that way lookAt doesn't need an up vector. it seems to work for all cases, it rotates around the poles in the opposite way than the old version but the effect is pretty much the same and it solves the degenerate case in #4594 and i guess anything else where the lookAt direction is parallel to {0,1,0}\r\n\r\nthis is the code i'm using for testing:\r\n\r\n```\r\n#include \"ofMain.h\"\r\n\r\nclass ofApp: public ofBaseApp\r\n{\r\n    ofNode target;\r\n    ofNode nodeNew, nodeOld;\r\n    ofEasyCam cam;\r\npublic:\r\n    void setup(){\r\n        ofSetBackgroundColor(0);\r\n        ofEnableDepthTest();\r\n        target.setPosition(10,10,10);\r\n    }\r\n\r\n    void update(){\r\n        auto lon = mouseX/float(ofGetWidth())*360.f;\r\n        auto lat = mouseY/float(ofGetHeight())*360.f;\r\n        nodeNew.orbit(lon,lat,100,target);\r\n        nodeOld.orbit(lon+30,lat,100,target);\r\n        nodeNew.lookAt(target);\r\n        nodeOld.lookAt(target, {0.f, 1.f, 0.f});\r\n    }\r\n\r\n    void draw(){\r\n        cam.setPosition(0,0,200);\r\n        cam.begin();\r\n        ofSetColor(255);\r\n        target.draw();\r\n        ofSetColor(ofColor::red);\r\n        nodeNew.draw();\r\n        ofSetColor(ofColor::green);\r\n        nodeOld.draw();\r\n        cam.end();\r\n    }\r\n};\r\n\r\nint main()\r\n{\r\n    ofGLFWWindowSettings settings;\r\n    settings.setGLVersion(3,2);\r\n    ofCreateWindow(settings);\r\n    ofRunApp(new ofApp);\r\n}\r\n``` "}}