[fix] 피격 범위 개선

- 레이 캐스트에서 구형 캐스트로 변경함

DEG-62
This commit is contained in:
fiore 2025-05-13 16:40:04 +09:00
parent 396f625ac8
commit 00fee9d6a2
2 changed files with 16 additions and 3 deletions

Binary file not shown.

View File

@ -51,9 +51,15 @@ public class BulletBase : MonoBehaviour
float moveDist = _speed * Time.deltaTime;
// 1) Raycast 충돌 검사
if (Physics.Raycast(_prevPosition, _direction, out RaycastHit hit, moveDist, _targetLayer))
if (Physics.SphereCast(
_prevPosition,
1,
_direction,
out RaycastHit hit,
moveDist,
_targetLayer
))
{
// 닿은 지점으로 이동
transform.position = hit.point;
OnBulletHit(hit);
return;
@ -85,4 +91,11 @@ public class BulletBase : MonoBehaviour
Debug.Log("## Bullet destroyed");
Destroy(gameObject);
}
// 기즈모로 반지름 시각화
private void OnDrawGizmosSelected()
{
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position, 1);
}
}