Caching position to avoid multiple built-in calls

This commit is contained in:
Stedd 2023-10-09 01:39:36 +02:00
parent d4790ce4eb
commit da88241204
1 changed files with 4 additions and 2 deletions

View File

@ -24,8 +24,10 @@ namespace GameDev.CoreSystems
if (!(_timeUntilFire <= 0)) return; if (!(_timeUntilFire <= 0)) return;
var ray = new Ray(BarrelEndPoint.position, BarrelEndPoint.forward); var position = BarrelEndPoint.position;
Debug.DrawRay(BarrelEndPoint.position, BarrelEndPoint.forward * 10, Color.green); var forward = BarrelEndPoint.forward;
var ray = new Ray(position, forward);
Debug.DrawRay(position, forward * 10, Color.green);
if (Physics.Raycast(ray, out RaycastHit hitInfo)) if (Physics.Raycast(ray, out RaycastHit hitInfo))
{ {