Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Destroy Game object on Collider

Discussion in 'Scripting' started by Ferkaluk, Aug 18, 2014.

  1. Ferkaluk

    Ferkaluk

    Joined:
    Aug 18, 2014
    Posts:
    11
    Hi I've made fast driving object, and parent to it mesh collider ( plane, Convex+Is Trigger+ IsRigidbody)
    My plane Collider deleting game object that I dont need after drive I use function:



    void OnTriggerEnter(Collider other)
    {

    if (other.tag == "kill_me") {

    Destroy(other.gameObject);

    }

    and everything seems to works fine, but if my main game object get fast speed some game object that have to be destroyed there isnt, it seems that collider sometimes work and sometimes don't

    //edit
    objects that I've destroyed are created first from Instantiate (tress, grass)
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,935
  3. angrypenguin

    angrypenguin

    Joined:
    Dec 29, 2011
    Posts:
    15,500
  4. Ferkaluk

    Ferkaluk

    Joined:
    Aug 18, 2014
    Posts:
    11
    thank you I will try repair this