mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2024-11-23 12:33:02 +00:00
don't use collider's transform position when checking for distance
This commit is contained in:
parent
7da990e105
commit
b8051fe2d9
1 changed files with 2 additions and 5 deletions
|
@ -81,13 +81,10 @@ namespace SanAndreasUnity.Utilities
|
|||
{
|
||||
Vector3 closestPointOnCollider = collider.ClosestPointOrBoundsCenter(center);
|
||||
float distanceToPointOnCollider = Vector3.Distance(center, closestPointOnCollider);
|
||||
float distanceToColliderTransform = Vector3.Distance(center, collider.transform.position);
|
||||
|
||||
float minDistance = Mathf.Min(distanceToPointOnCollider, distanceToColliderTransform);
|
||||
|
||||
if (minDistance < closestPointDistance)
|
||||
if (distanceToPointOnCollider < closestPointDistance)
|
||||
{
|
||||
closestPointDistance = minDistance;
|
||||
closestPointDistance = distanceToPointOnCollider;
|
||||
closestPointCollider = collider;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue