Fix hit sorting
This commit is contained in:
parent
3636f39143
commit
231054030b
@ -179,6 +179,7 @@ namespace NeonTea.Quakeball.Players {
|
|||||||
Vector3 From = CameraRoot.position;
|
Vector3 From = CameraRoot.position;
|
||||||
Vector3 Direction = CameraRoot.forward;
|
Vector3 Direction = CameraRoot.forward;
|
||||||
RaycastHit[] Hits = Physics.RaycastAll(From, Direction, 1000f, BulletHitLayer);
|
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) {
|
foreach (RaycastHit Hit in Hits) {
|
||||||
ShotDelta = Hit.point - GunPoint;
|
ShotDelta = Hit.point - GunPoint;
|
||||||
Player Player = Hit.rigidbody != null ? Hit.rigidbody.GetComponent<Player>() : null;
|
Player Player = Hit.rigidbody != null ? Hit.rigidbody.GetComponent<Player>() : null;
|
||||||
|
Loading…
Reference in New Issue
Block a user