From f986dc197b5e093575bc0b56ee0ded991c228639 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Tue, 9 May 2023 13:14:14 +0800 Subject: *misc --- marching/Assets/Scripts/Utils/Vector4Extension.cs | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 marching/Assets/Scripts/Utils/Vector4Extension.cs (limited to 'marching/Assets/Scripts/Utils/Vector4Extension.cs') diff --git a/marching/Assets/Scripts/Utils/Vector4Extension.cs b/marching/Assets/Scripts/Utils/Vector4Extension.cs new file mode 100644 index 0000000..e4b9b35 --- /dev/null +++ b/marching/Assets/Scripts/Utils/Vector4Extension.cs @@ -0,0 +1,34 @@ +using System.Collections; +using System.Collections.Generic; +using Unity.VisualScripting; +using UnityEditor; +using UnityEngine; + +public static class Vector4Extension +{ + + public static Vector2 xy(this Vector4 src) + { + Vector2 xy = new Vector2(); + xy.x = src.x; + xy.y = src.y; + return xy; + } + + public static Vector2 zw(this Vector4 src) + { + Vector2 zw = new Vector2(); + zw.x = src.z; + zw.y = src.w; + return zw; + } + + public static Vector2 ToVector2(this Vector4 src) + { + Vector2 xy = new Vector2(); + xy.x = src.x; + xy.y = src.y; + return xy; + } + +} -- cgit v1.1-26-g67d0