From a80c2af23d184fe0a273d353741869e8d24861e7 Mon Sep 17 00:00:00 2001 From: LeeJaeHyun Date: Thu, 12 Sep 2024 14:16:06 +0900 Subject: [PATCH] . --- Assets/02_Scripts/RemoveBullet.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Assets/02_Scripts/RemoveBullet.cs b/Assets/02_Scripts/RemoveBullet.cs index 694c344..21612d5 100644 --- a/Assets/02_Scripts/RemoveBullet.cs +++ b/Assets/02_Scripts/RemoveBullet.cs @@ -18,6 +18,18 @@ public class RemoveBullet : MonoBehaviour if (coll.collider.CompareTag("BULLET")) { 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); } }