public bool Raycast(Vector3 position, Vector3 direction, out HitscanInfo scanInfo, float maxDistance, Vector3 muzzle) { scanInfo = default; scanInfo.origin = position; scanInfo.direction = direction; scanInfo.maxDistance = maxDistance; scanInfo.muzzle = muzzle; bool success = Physics.Raycast(position, direction, out scanInfo.hitInfo, maxDistance, layerMask); scanInfo.success = success; // Events processing HitscanEventArgs args = new HitscanEventArgs(scanInfo); Launched?.Invoke(this, args); if (success) { Impacted?.Invoke(this, args); } return(success); }
public HitscanEventArgs(HitscanInfo scanInfo) { this.scanInfo = scanInfo; }
public static bool Raycast(Vector3 position, Vector3 direction, out HitscanInfo scanInfo, float maxDistance) { return(Current.manager.Raycast(position, direction, out scanInfo, maxDistance)); }
public bool Raycast(Vector3 position, Vector3 direction, out HitscanInfo scanInfo, float maxDistance) { return(Raycast(position, direction, out scanInfo, maxDistance, position)); }