private bool IsWeaponUnderground(MuzzleLogicAccessor muzzlePoint, int mask, TankNode tank, GameObject[] raycastExclusionGameObjects) { RaycastHit hit; Vector3 center = tank.tankColliders.BoundsCollider.bounds.center; Vector3 dir = muzzlePoint.GetBarrelOriginWorld() - center; return(PhysicsUtil.RaycastWithExclusion(center, dir, out hit, dir.magnitude, mask, raycastExclusionGameObjects)); }
private bool IsWeaponBlocked(MuzzleLogicAccessor muzzlePoint, int mask, out RaycastHit hitInfo, GameObject[] raycastExclusionGameObjects) { Vector3 worldPosition = muzzlePoint.GetWorldPosition(); Vector3 barrelOriginWorld = muzzlePoint.GetBarrelOriginWorld(); float distance = (worldPosition - barrelOriginWorld).magnitude + 0.1f; return(PhysicsUtil.RaycastWithExclusion(barrelOriginWorld, worldPosition - barrelOriginWorld, out hitInfo, distance, mask, raycastExclusionGameObjects)); }