diff options
Diffstat (limited to 'modules/mono')
3 files changed, 15 insertions, 18 deletions
diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs index e849939ebb..0dac8205b6 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector2I.cs @@ -504,15 +504,15 @@ namespace Godot } /// <summary> - /// Converts a <see cref="Vector2"/> to a <see cref="Vector2I"/>. + /// Converts a <see cref="Vector2"/> to a <see cref="Vector2I"/> by truncating + /// components' fractional parts (rounding towards zero). For a different + /// behavior consider passing the result of <see cref="Vector2.Ceil"/>, + /// <see cref="Vector2.Floor"/> or <see cref="Vector2.Round"/> to this conversion operator instead. /// </summary> /// <param name="value">The vector to convert.</param> public static explicit operator Vector2I(Vector2 value) { - return new Vector2I( - Mathf.RoundToInt(value.X), - Mathf.RoundToInt(value.Y) - ); + return new Vector2I((int)value.X, (int)value.Y); } /// <summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs index fe899527ef..a2927533f8 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector3I.cs @@ -559,16 +559,15 @@ namespace Godot } /// <summary> - /// Converts a <see cref="Vector3"/> to a <see cref="Vector3I"/>. + /// Converts a <see cref="Vector3"/> to a <see cref="Vector3I"/> by truncating + /// components' fractional parts (rounding towards zero). For a different + /// behavior consider passing the result of <see cref="Vector3.Ceil"/>, + /// <see cref="Vector3.Floor"/> or <see cref="Vector3.Round"/> to this conversion operator instead. /// </summary> /// <param name="value">The vector to convert.</param> public static explicit operator Vector3I(Vector3 value) { - return new Vector3I( - Mathf.RoundToInt(value.X), - Mathf.RoundToInt(value.Y), - Mathf.RoundToInt(value.Z) - ); + return new Vector3I((int)value.X, (int)value.Y, (int)value.Z); } /// <summary> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs index f065327066..bb552b939d 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Vector4I.cs @@ -580,17 +580,15 @@ namespace Godot } /// <summary> - /// Converts a <see cref="Vector4"/> to a <see cref="Vector4I"/>. + /// Converts a <see cref="Vector4"/> to a <see cref="Vector4I"/> by truncating + /// components' fractional parts (rounding towards zero). For a different + /// behavior consider passing the result of <see cref="Vector4.Ceil"/>, + /// <see cref="Vector4.Floor"/> or <see cref="Vector4.Round"/> to this conversion operator instead. /// </summary> /// <param name="value">The vector to convert.</param> public static explicit operator Vector4I(Vector4 value) { - return new Vector4I( - Mathf.RoundToInt(value.X), - Mathf.RoundToInt(value.Y), - Mathf.RoundToInt(value.Z), - Mathf.RoundToInt(value.W) - ); + return new Vector4I((int)value.X, (int)value.Y, (int)value.Z, (int)value.W); } /// <summary> |