diff options
author | Max Hilbrunner <mhilbrunner@users.noreply.github.com> | 2018-05-05 20:52:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-05 20:52:16 +0200 |
commit | 2bf71d0eeadbd2e497b1555bf1f04993f7f3d63a (patch) | |
tree | 6d162229de7b46b582479695fe9a2592dff925da | |
parent | c9f5288b671ea7dda8a07e9834058438ebe8bbc4 (diff) | |
parent | a6bd2c6e72de373fab783d2ce15b67f5413e98ea (diff) |
Merge pull request #18613 from KellyThomas/vector-methods-csharp
round / ceil methods for c sharp vectors
-rw-r--r-- | modules/mono/glue/cs_files/Vector2.cs | 10 | ||||
-rw-r--r-- | modules/mono/glue/cs_files/Vector3.cs | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/modules/mono/glue/cs_files/Vector2.cs b/modules/mono/glue/cs_files/Vector2.cs index cc2cda82fb..9bc40cf8df 100644 --- a/modules/mono/glue/cs_files/Vector2.cs +++ b/modules/mono/glue/cs_files/Vector2.cs @@ -97,6 +97,11 @@ namespace Godot return -Reflect(n); } + public Vector2 Ceil() + { + return new Vector2(Mathf.Ceil(x), Mathf.Ceil(y)); + } + public Vector2 Clamped(real_t length) { var v = this; @@ -190,6 +195,11 @@ namespace Godot return new Vector2(Mathf.Cos(rads), Mathf.Sin(rads)) * Length(); } + public Vector2 Round() + { + return new Vector2(Mathf.Round(x), Mathf.Round(y)); + } + public void Set(real_t x, real_t y) { this.x = x; diff --git a/modules/mono/glue/cs_files/Vector3.cs b/modules/mono/glue/cs_files/Vector3.cs index 0a71f3fa4d..57e4494f7e 100644 --- a/modules/mono/glue/cs_files/Vector3.cs +++ b/modules/mono/glue/cs_files/Vector3.cs @@ -219,6 +219,11 @@ namespace Godot return 2.0f * n * Dot(n) - this; } + public Vector3 Round() + { + return new Vector3(Mathf.Round(x), Mathf.Round(y), Mathf.Round(z)); + } + public Vector3 Rotated(Vector3 axis, real_t phi) { return new Basis(axis, phi).Xform(this); |