Unity3D - 메모장

quest3dkorea.com


통계 위젯 (화이트)

2328
170
137734


Shell on trigger Unity3D 스크립트

    private void OnTriggerEnter(Collider other) {
        Collider[] colliders = Physics.OverlapSphere(transform.position, m_ExplosionRadius, m_TankMask);
        for (int i = 0; i < colliders.Length; i++) {
            Rigidbody targetRigidbody = colliders[i].GetComponent<Rigidbody>();
            if (!targetRigidbody)
                continue;

            targetRigidbody.AddExplosionForce(m_ExplosionForce, transform.position, m_ExplosionRadius);
        }

        m_ExplosionParticles.transform.parent = null;

        m_ExplosionParticles.Play();

        ParticleSystem.MainModule mainModule = m_ExplosionParticles.main;
        m_ExplosionParticles.GetComponent<AudioSource>().Play();
        Destroy(m_ExplosionParticles.gameObject, mainModule.duration);

        Destroy(gameObject);
    }

덧글

댓글 입력 영역