Compare commits

...

2 Commits

Author SHA1 Message Date
9b83721f17 SJK scriptts Bumped to 1.0.17
Some checks failed
Spellcheck / Spellcheck (push) Failing after 1m39s
Tests / Evaluate Tests on ubuntu-latest (push) Successful in 1m18s
2026-06-10 14:35:17 -04:00
247300c09c Bumped SJKScript Vesion and added vector Lerp 2026-06-10 14:34:33 -04:00
3 changed files with 37 additions and 3 deletions

View File

@@ -48,6 +48,7 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="GodotSharp" Version="4.6.2" /> <PackageReference Include="GodotSharp" Version="4.6.2" />
<PackageReference Include="SjkScripts" Version="1.0.15" /> <PackageReference Include="SjkScripts" Version="1.0.17" />
<!-- [1.2.3,2.3.4] use range of versions -->
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -8,7 +8,7 @@ public static partial class SJKMath
// Mathf.Lerp(from.Y, to.Y, weight), // Mathf.Lerp(from.Y, to.Y, weight),
// Mathf.Lerp(from.Z, to.Z, weight) // Mathf.Lerp(from.Z, to.Z, weight)
// ); // );
public static Vector3 Lerp(Vector3 from, Vector3 to, float weight) => new Vector3( public static Vector3 Lerp(this Vector3 from, Vector3 to, float weight) => new Vector3(
Mathf.Lerp(from.X, to.X, weight), Mathf.Lerp(from.X, to.X, weight),
Mathf.Lerp(from.Y, to.Y, weight), Mathf.Lerp(from.Y, to.Y, weight),
Mathf.Lerp(from.Z, to.Z, weight) Mathf.Lerp(from.Z, to.Z, weight)
@@ -17,7 +17,7 @@ public static partial class SJKMath
// Mathf.Lerp(from.X, to.X, weight), // Mathf.Lerp(from.X, to.X, weight),
// Mathf.Lerp(from.Y, to.Y, weight) // Mathf.Lerp(from.Y, to.Y, weight)
// ); // );
public static Vector2 Lerp(Vector2 from, Vector2 to, float weight) => new Vector2( public static Vector2 Lerp(this Vector2 from, Vector2 to, float weight) => new Vector2(
Mathf.Lerp(from.X, to.X, weight), Mathf.Lerp(from.X, to.X, weight),
Mathf.Lerp(from.Y, to.Y, weight) Mathf.Lerp(from.Y, to.Y, weight)
); );

View File

@@ -0,0 +1,33 @@
namespace GodotHelpers;
using Godot;
public static partial class SJKMath
{
public static Vector3I RoundToIntVector(this Vector3 vector) => new Vector3I(
Mathf.RoundToInt(vector.X),
Mathf.RoundToInt(vector.Y),
Mathf.RoundToInt(vector.Z)
);
public static Vector3I FloorToIntVector(this Vector3 vector) => new Vector3I(
Mathf.FloorToInt(vector.X),
Mathf.FloorToInt(vector.Y),
Mathf.FloorToInt(vector.Z)
);
public static Vector3I CeilToIntVector(this Vector3 vector) => new Vector3I(
Mathf.CeilToInt(vector.X),
Mathf.CeilToInt(vector.Y),
Mathf.CeilToInt(vector.Z)
);
public static Vector2I RoundToIntVector(this Vector2 vector) => new Vector2I(
Mathf.RoundToInt(vector.X),
Mathf.RoundToInt(vector.Y)
);
public static Vector2I FloorToIntVector(this Vector2 vector) => new Vector2I(
Mathf.FloorToInt(vector.X),
Mathf.FloorToInt(vector.Y)
);
public static Vector2I CeilToIntVector(this Vector2 vector) => new Vector2I(
Mathf.CeilToInt(vector.X),
Mathf.CeilToInt(vector.Y)
);
}