Last active
April 2, 2017 12:49
-
-
Save hasanbayatme/f05a1b85f08953e99a6078a0b25a779b to your computer and use it in GitHub Desktop.
Convert Vectors in Right way using Extension method from any to any.
This file contains hidden or 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
public static class VectorExtensions | |
{ | |
public static Vector2 ToVector2 ( this Vector3 vector ) | |
{ | |
return (Vector2)vector; | |
} | |
public static Vector2 ToVector2 ( this Vector4 vector ) | |
{ | |
return (Vector2)vector; | |
} | |
public static Vector3 ToVector3 ( this Vector2 vector ) | |
{ | |
return (Vector3)vector; | |
} | |
public static Vector3 ToVector3 ( this Vector4 vector ) | |
{ | |
return (Vector3)vector; | |
} | |
public static Vector4 ToVector4 ( this Vector2 vector ) | |
{ | |
return (Vector4)vector; | |
} | |
public static Vector4 ToVector4 ( this Vector3 vector ) | |
{ | |
return (Vector4)vector; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment