Fix hit sorting

This commit is contained in:
Jens Pitkänen 2020-08-08 16:11:29 +03:00
parent 3636f39143
commit 231054030b
1 changed files with 1 additions and 0 deletions

View File

@ -179,6 +179,7 @@ namespace NeonTea.Quakeball.Players {
Vector3 From = CameraRoot.position;
Vector3 Direction = CameraRoot.forward;
RaycastHit[] Hits = Physics.RaycastAll(From, Direction, 1000f, BulletHitLayer);
System.Array.Sort(Hits, (a, b) => { return a.distance.CompareTo(b.distance); });
foreach (RaycastHit Hit in Hits) {
ShotDelta = Hit.point - GunPoint;
Player Player = Hit.rigidbody != null ? Hit.rigidbody.GetComponent<Player>() : null;