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

Collision between two objects not working

Discussion in 'Scripting' started by ostrich160, May 26, 2014.

  1. ostrich160

    ostrich160

    Joined:
    Feb 28, 2012
    Posts:
    679
    Hi guys, so Im trying to make this script work...

    So this is attached to the floor, and what should happen is when a force hits my player and he lands on his head, when his head and the floor collide, the player should disappear. I have an illustration that should help

    $Demonstrate.png

    So this should explain it, can anyone tell me why my script isnt working?

    Thanks guys, because Im stumped.
     
  2. ostrich160

    ostrich160

    Joined:
    Feb 28, 2012
    Posts:
    679
  3. sootie8

    sootie8

    Joined:
    Mar 25, 2014
    Posts:
    233
    My advice is to use a second collider on the plane, which is slightly above the terrain, then set that collider to isTrigger.
     
  4. ostrich160

    ostrich160

    Joined:
    Feb 28, 2012
    Posts:
    679
    I dont really know what you mean. I tried making a plane slightly above the terrain, setting the collider to is trigger, and changing the code to the following

    But that didnt work. Either the plane killed the player without even touching the trigger, or the trigger colliding with the plane didnt kill the player.