Just in case change type cast for other variables as well

This commit is contained in:
Andrej Stojkovikj
2023-09-19 15:57:33 +02:00
parent e1f528ec9a
commit 3f299f4cf6
2 changed files with 10 additions and 10 deletions

View File

@@ -991,16 +991,16 @@ namespace FlaxEngine
public static Vector2 SmoothDamp(Vector2 current, Vector2 target, ref Vector2 currentVelocity, float smoothTime, [DefaultValue("float.PositiveInfinity")] float maxSpeed, [DefaultValue("Time.DeltaTime")] float deltaTime)
{
smoothTime = Mathf.Max(0.0001f, smoothTime);
float a = 2f / smoothTime;
float b = a * deltaTime;
float e = 1f / (1f + b + 0.48f * b * b + 0.235f * b * b * b);
Real a = 2f / smoothTime;
Real b = a * deltaTime;
Real e = 1f / (1f + b + 0.48f * b * b + 0.235f * b * b * b);
Real change_x = current.X - target.X;
Real change_y = current.Y - target.Y;
Vector2 originalTo = target;
float maxChangeSpeed = maxSpeed * smoothTime;
float changeSq = maxChangeSpeed * maxChangeSpeed;
Real maxChangeSpeed = maxSpeed * smoothTime;
Real changeSq = maxChangeSpeed * maxChangeSpeed;
Real sqrDist = change_x * change_x + change_y * change_y;
if (sqrDist > changeSq)
{

View File

@@ -1080,9 +1080,9 @@ namespace FlaxEngine
public static Vector3 SmoothDamp(Vector3 current, Vector3 target, ref Vector3 currentVelocity, float smoothTime, [DefaultValue("float.PositiveInfinity")] float maxSpeed, [DefaultValue("Time.DeltaTime")] float deltaTime)
{
smoothTime = Mathf.Max(0.0001f, smoothTime);
float a = 2f / smoothTime;
float b = a * deltaTime;
float e = 1f / (1f + b + 0.48f * b * b + 0.235f * b * b * b);
Real a = 2f / smoothTime;
Real b = a * deltaTime;
Real e = 1f / (1f + b + 0.48f * b * b + 0.235f * b * b * b);
Real change_x = current.X - target.X;
Real change_y = current.Y - target.Y;
@@ -1090,8 +1090,8 @@ namespace FlaxEngine
Vector3 originalTo = target;
float maxChangeSpeed = maxSpeed * smoothTime;
float changeSq = maxChangeSpeed * maxChangeSpeed;
Real maxChangeSpeed = maxSpeed * smoothTime;
Real changeSq = maxChangeSpeed * maxChangeSpeed;
Real sqrMag = change_x * change_x + change_y * change_y + change_z * change_z;
if (sqrMag > changeSq)
{