Skip to content

Commit

Permalink
Fixed compile errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillemsc committed Dec 10, 2023
1 parent 7e4e8e3 commit bdef397
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion GTweens
24 changes: 21 additions & 3 deletions Godot/Source/Extensions/AngleExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,34 @@ namespace GTweensGodot.Extensions;

public static class AngleExtensions
{
public static Vector3 Clamp360(Vector3 eulerAngles)
{
return new Vector3(
GTweens.Extensions.AngleExtensions.Clamp360(eulerAngles.X),
GTweens.Extensions.AngleExtensions.Clamp360(eulerAngles.Y),
GTweens.Extensions.AngleExtensions.Clamp360(eulerAngles.Z)
);
}

public static Vector3 DeltaAngle(Vector3 current, Vector3 target)
{
return new Vector3(
GTweens.Extensions.AngleExtensions.DeltaAngle(current.X, target.X),
GTweens.Extensions.AngleExtensions.DeltaAngle(current.Y, target.Y),
GTweens.Extensions.AngleExtensions.DeltaAngle(current.Z, target.Z)
);
}

public static Vector3 GetDestinationAngleDegrees(Vector3 origin, Vector3 destination, RotationMode mode)
{
switch (mode)
{
case RotationMode.ShortestDistance:
{
Vector3 clampedOrigin = GTweens.Extensions.AngleExtensions.Clamp360(origin);
Vector3 clampedDestination = GTweens.Extensions.AngleExtensions.Clamp360(destination);
Vector3 clampedOrigin = Clamp360(origin);
Vector3 clampedDestination = Clamp360(destination);

Vector3 deltaAngle = GTweens.Extensions.AngleExtensions.DeltaAngle(clampedOrigin, clampedDestination);
Vector3 deltaAngle = DeltaAngle(clampedOrigin, clampedDestination);

return origin + deltaAngle;
}
Expand Down

0 comments on commit bdef397

Please sign in to comment.