summaryrefslogtreecommitdiff
path: root/modules/mono/editor/script_templates
diff options
context:
space:
mode:
authorRaul Santos <raulsntos@gmail.com>2022-08-01 04:06:35 +0200
committerRaul Santos <raulsntos@gmail.com>2022-08-22 21:11:24 +0200
commit0b8b733d77ba9acca2f0b864d020732e2a265edc (patch)
tree4b43888786a0d56f85ed5f97b11b7ec7bfd6d62d /modules/mono/editor/script_templates
parent8a1e5980116355024cd7a7ce0c15db7d4ecb200a (diff)
C#: Replace `Xform` and `XformInv` with `*` operator
- In cases where both `Xform`/`XformInv` and the `*` operator were implemented the `Xform`/`XformInv` methods were removed in favor of the `*` operator. - In cases where the `Xform`/`XformInv` existed but not the `*` operator, the `Xform`/`XformInv` methods were replaced with the `*` operator. - In cases where no method existed, a new `*` operator has been implemented to support the same operations that are supported in GDScript. - Fixes the `Transform.Xform` and `Transform.XformInv` with `Rect2` implementation to use a zero `Rect2` size to start expanding from (which is how it's implemented in C++).
Diffstat (limited to 'modules/mono/editor/script_templates')
-rw-r--r--modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs b/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs
index 188bbb775c..069908c426 100644
--- a/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs
+++ b/modules/mono/editor/script_templates/CharacterBody3D/basic_movement.cs
@@ -26,7 +26,7 @@ public partial class _CLASS_ : _BASE_
// Get the input direction and handle the movement/deceleration.
// As good practice, you should replace UI actions with custom gameplay actions.
Vector2 inputDir = Input.GetVector("ui_left", "ui_right", "ui_up", "ui_down");
- Vector3 direction = Transform.basis.Xform(new Vector3(inputDir.x, 0, inputDir.y)).Normalized();
+ Vector3 direction = (Transform.basis * new Vector3(inputDir.x, 0, inputDir.y)).Normalized();
if (direction != Vector3.Zero)
{
velocity.x = direction.x * Speed;