summaryrefslogtreecommitdiff
path: root/modules/mono
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-05-25 09:44:03 +0200
committerGitHub <noreply@github.com>2018-05-25 09:44:03 +0200
commit17faf111190e0061a91a8913dcbed3c03dd5c1c8 (patch)
treed175796a5c434aa4988b5316b4c9b8132395ab5b /modules/mono
parentb4d3b6a5403f8f2bdd801825b251944d191c3303 (diff)
parentb335274bcd6df9ad7e4ba381574fd1607f2b3437 (diff)
Merge pull request #19063 from KellyThomas/c-sharp-feature-parity-vectors
mono: Add Slerp method to vector classes, expose Cross method for Vector2
Diffstat (limited to 'modules/mono')
-rw-r--r--modules/mono/glue/cs_files/Basis.cs6
-rwxr-xr-xmodules/mono/glue/cs_files/VERSION.txt2
-rw-r--r--modules/mono/glue/cs_files/Vector2.cs8
-rw-r--r--modules/mono/glue/cs_files/Vector3.cs6
4 files changed, 17 insertions, 5 deletions
diff --git a/modules/mono/glue/cs_files/Basis.cs b/modules/mono/glue/cs_files/Basis.cs
index 270f3b80a2..aa49a5e04f 100644
--- a/modules/mono/glue/cs_files/Basis.cs
+++ b/modules/mono/glue/cs_files/Basis.cs
@@ -453,15 +453,15 @@ namespace Godot
c = Mathf.Cos(euler.x);
s = Mathf.Sin(euler.x);
- var xmat = new Basis((real_t)1.0, (real_t)0.0, (real_t)0.0, (real_t)0.0, c, -s, (real_t)0.0, s, c);
+ var xmat = new Basis(1, 0, 0, 0, c, -s, 0, s, c);
c = Mathf.Cos(euler.y);
s = Mathf.Sin(euler.y);
- var ymat = new Basis(c, (real_t)0.0, s, (real_t)0.0, (real_t)1.0, (real_t)0.0, -s, (real_t)0.0, c);
+ var ymat = new Basis(c, 0, s, 0, 1, 0, -s, 0, c);
c = Mathf.Cos(euler.z);
s = Mathf.Sin(euler.z);
- var zmat = new Basis(c, -s, (real_t)0.0, s, c, (real_t)0.0, (real_t)0.0, (real_t)0.0, (real_t)1.0);
+ var zmat = new Basis(c, -s, 0, s, c, 0, 0, 0, 1);
this = ymat * xmat * zmat;
}
diff --git a/modules/mono/glue/cs_files/VERSION.txt b/modules/mono/glue/cs_files/VERSION.txt
index 0cfbf08886..00750edc07 100755
--- a/modules/mono/glue/cs_files/VERSION.txt
+++ b/modules/mono/glue/cs_files/VERSION.txt
@@ -1 +1 @@
-2
+3
diff --git a/modules/mono/glue/cs_files/Vector2.cs b/modules/mono/glue/cs_files/Vector2.cs
index 9bc40cf8df..c274364895 100644
--- a/modules/mono/glue/cs_files/Vector2.cs
+++ b/modules/mono/glue/cs_files/Vector2.cs
@@ -62,7 +62,7 @@ namespace Godot
}
}
- private real_t Cross(Vector2 b)
+ public real_t Cross(Vector2 b)
{
return x * b.y - y * b.x;
}
@@ -210,6 +210,12 @@ namespace Godot
x = v.x;
y = v.y;
}
+
+ public Vector2 Slerp(Vector2 b, real_t t)
+ {
+ real_t theta = AngleTo(b);
+ return Rotated(theta * t);
+ }
public Vector2 Slide(Vector2 n)
{
diff --git a/modules/mono/glue/cs_files/Vector3.cs b/modules/mono/glue/cs_files/Vector3.cs
index 57e4494f7e..085a4f0043 100644
--- a/modules/mono/glue/cs_files/Vector3.cs
+++ b/modules/mono/glue/cs_files/Vector3.cs
@@ -242,6 +242,12 @@ namespace Godot
z = v.z;
}
+ public Vector3 Slerp(Vector3 b, real_t t)
+ {
+ real_t theta = AngleTo(b);
+ return Rotated(Cross(b), theta * t);
+ }
+
public Vector3 Slide(Vector3 n)
{
return this - n * Dot(n);