duck

Untitled

Jun 28th, 2011
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.59 KB | None | 0 0
  1.  
  2. float hScale = (flipH ? -1 : 1);
  3. float vScale = (flipV ? -1 : 1);
  4. Vector3 scaleVector = new Vector3(hScale, vScale,1 );
  5.  
  6. Matrix4x4 scaleMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scaleVector );
  7. Matrix4x4 offsetMatrix = Matrix4x4.TRS(new Vector3(-pos.x,-pos.y,0), Quaternion.identity, Vector3.one );
  8. Matrix4x4 rotationMatrix = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0,0,angle), Vector3.one );
  9. Matrix4x4 offsetBackMatrix = Matrix4x4.TRS(new Vector3(pos.x,pos.y,0), Quaternion.identity, Vector3.one );
  10.  
  11. matrix = offsetBackMatrix * rotationMatrix * offsetMatrix * scaleMatrix;
Advertisement
Add Comment
Please, Sign In to add comment