Created
September 20, 2013 12:52
-
-
Save patriciogonzalezvivo/6637016 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void rotateTo(ofPoint _dir){ | |
ofVec3f newTarget = _dir; | |
newTarget.normalize(); | |
ofVec3f up( 0, -1, 0 ); | |
ofVec3f axis = up.crossed( newTarget ); | |
axis.normalize(); | |
float angle = up.angle( newTarget ); | |
ofRotate( angle, axis.x, axis.y, axis.z ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment