Refactor; Optimize simulation
This commit is contained in:
parent
8581cf6fb8
commit
0ef5652cea
16 changed files with 508 additions and 651 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System;
|
||||
using Godot;
|
||||
|
||||
public static class Helpers
|
||||
|
|
@ -27,18 +28,12 @@ public static class Helpers
|
|||
return true;
|
||||
}
|
||||
|
||||
public static bool IsInsideGlobalArea(Vector3Dec areaStart, Vector3Dec areaEnd, Vector3Dec coordinates)
|
||||
public static double GetDistance(Vector3 position1, Vector3 position2)
|
||||
{
|
||||
if (coordinates.X >= areaEnd.X || coordinates.Y >= areaEnd.Y || coordinates.Z >= areaEnd.Z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
double diffX = Math.Abs(position1.X - position2.X);
|
||||
double diffY = Math.Abs(position1.Y - position2.Y);
|
||||
double diffZ = Math.Abs(position1.Z - position2.Z);
|
||||
|
||||
if (coordinates.X < areaStart.X || coordinates.Y < areaStart.Y || coordinates.Z < areaStart.Z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return Math.Sqrt(diffX * diffX + diffY * diffY + diffZ * diffZ);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue