Created
July 10, 2018 07:55
-
-
Save Pyromuffin/e934b7188f82c5466f14f686b6a22054 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
Matrix4x4 mat; | |
mat = Matrix4x4.Translate(new Vector3(centerPoint.x, centerPoint.y)); | |
mat *= Matrix4x4.Rotate(Quaternion.AngleAxis(degrees, Vector3.forward)); | |
mat *= Matrix4x4.Translate(new Vector3(-centerPoint.x, -centerPoint.y)); | |
IntegerBasis basis; | |
basis.right = new Vector2Int( Mathf.RoundToInt(mat.m00 * BIG_NUMBER), Mathf.RoundToInt(mat.m01 * BIG_NUMBER)); | |
basis.up = new Vector2Int( Mathf.RoundToInt(mat.m10 * BIG_NUMBER), Mathf.RoundToInt(mat.m11 * BIG_NUMBER)); | |
basis.offset = new Vector2Int( Mathf.RoundToInt(mat.m03 * BIG_NUMBER), Mathf.RoundToInt(mat.m13 * BIG_NUMBER)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment