Created
May 12, 2020 04:35
-
-
Save skyburchard/b3afc70c06d06d898d8c7972b830a1ec 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
//////////////////////////////////////////////////////// | |
// rotate a point around another point using quaternions | |
// set quaterion by vector | |
var quat = Quaternion.LookRotation(Vector3 forward, Vector3 upwards = Vector3.up); | |
// set quaternion by angle | |
var quat = Quaternion.AngleAxis(float angle, Vector3 axis); | |
// rotate around pivit point | |
Vector3 RotateAroundPoint(Vector3 point, Vector3 pivot, Quaternion angle) | |
{ | |
return angle * ( point - pivot) + pivot; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment