1. 구조물 내구도 시스템 구현
- Durability.cs
- maxDurability, currentDurability로 내구도 관리
- public void ApplyDamage(float amount) 메서드로 외부에서 내구도 차감
- 내구도 ≤ 0일 때 transform.root.gameObject 전체 파괴
2. 토네이도(TornadoController)와 충돌 처리
- SphereCollider(isTrigger=true) + Rigidbody(kinematic) 조합으로 트리거 이벤트 발생
- OnTriggerEnter → 진입 순간 1프레임 데미지
- OnTriggerStay → 매 프레임 damagePerSecond * Time.deltaTime 지속 데미지
- OnTriggerExit → 이탈 시점 로그(또는 추가 이벤트)
3. 토네이도 생성기(TornadoSpawner) 개선
- SpawnOne()
- Instantiate(tornadoPrefab, GetRandomPos(), …)
- tc.Spawner = this; tc.TornadoSetting(); 으로 경계(middlepoint) 초기화
- SpawnTornado() 코루틴
- time 누적 로직 대신 yield return new WaitForSeconds(tornadoSpawnTime)로 대체하면 가독성·성능 향상 가능
4. 물리 콜라이더 & Rigidbody 세팅
- GroundPoint(토네이도 콜라이더) 또는 구조물 쪽에 Rigidbody(isKinematic=true)가 반드시 있어야 OnTriggerXXX 호출
- MeshCollider 사용 시 “Convex” 옵션을 켜야 PhysX 트리거 이벤트를 지원
5. GrabPass 관련 D3D12 오류 원인 & 해결
- 에러
Use of GfxDeviceD3D12::GrabIntoRenderTexture is forbidden during a render pass!
- 원인:
- 내장 “Soft Particles” 셰이더가 <GrabPass> 를 사용 → 렌더 중에 화면 복사 시도
- D3D12 드라이버에서 “렌더 패스 중 복사 금지” 처리
- 해결:
- URP 전용 파티클 셰이더(Unlit Particle / Lit Particle)로 머티리얼 교체
- Soft Particles 옵션 비활성화(또는 _InvFade = 0)
- 이로써 GrabPass 없이 _CameraDepthTexture 기반 Soft-Particles 사용 가능
오늘 배운 점
- Unity 물리 이벤트 조건(Trigger+Rigidbody)과 MeshCollider 제약
- 코루틴으로 스폰 주기 관리하기
- D3D12에서 GrabPass/Soft Particles의 충돌 원리
- URP 셰이더 전환을 통한 안전한 Soft Particle 처리