This commit is contained in:
LeeJaeHyun 2024-09-12 14:16:06 +09:00
parent 362e56ee5f
commit a80c2af23d

View File

@ -18,6 +18,18 @@ public class RemoveBullet : MonoBehaviour
if (coll.collider.CompareTag("BULLET")) if (coll.collider.CompareTag("BULLET"))
{ {
Destroy(coll.gameObject); Destroy(coll.gameObject);
// 충돌 정보
ContactPoint cp = coll.GetContact(0);
// 충돌 지점(좌표)
Vector3 pos = cp.point;
// 충돌 지점의 법선 벡터
Vector3 normal = -cp.normal;
// 벡터를 Quaternion 타입으로 변환
Quaternion rot = Quaternion.LookRotation(normal);
// 스파크 생성
Instantiate(sparkEffect, pos, rot);
} }
} }