I'm trying to run a fairly simple bomb gameplay element which requires destructible objects to recognize the bomb's trigger/collider hitting them.

image

Currently, I have a prefab (bomb) that spawns with an input press, which has a trigger collider attached. When it explodes, the trigger collider expands.
In this example, there's a rock that can be destroyed by the bomb exploding. I have a trigger machine on the rock which is set to activate a machine to destroy it, when it registers an object named Bomb entering its triggers.

However, I cannot get the two objects to interact and activate the trigger machine. Is there something I'm doing wrong, that the two objects cant trigger one another?
Agender, curry fan, Top 10 lister, indie dev, gym hitter, musician, et al.
  • I've additionally tried this with the bomb playing a triggermachine of its own when it detects the collider from the rock.

    Currently the bomb's trigger machine works on the player, but not on the rock itself. I made a copy of the trigger machine, and set it to start with an object named BombTarget (the name of the rock), and still no luck.

    For the record, both the bomb and the rock are both the same tag and layer.
    Agender, curry fan, Top 10 lister, indie dev, gym hitter, musician, et al.
  • Is there a rigidbody (2D) component involved? Without it Unity physics (e.g. entering a trigger) doesn't work - so at least one of them should have a rigidbody.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Hmm, I hadn't considered that. I'll try giving at least one a rigidbody.

    Additionally, I had someone mention that the Name field may be unreliable if using prefabs, since they may have the clone tag affixed to them.

    Will give it another go, and if I have more trouble I'll report back! Thanks GiL :)
    Agender, curry fan, Top 10 lister, indie dev, gym hitter, musician, et al.
  • Alright! The combination of rigidbody on the rock and using specific tags got it working.

    Thanks so much for the guidance, GiL! Always appreciate you taking time to help out!
    Agender, curry fan, Top 10 lister, indie dev, gym hitter, musician, et al.
  • An alternative setup would be using tagged machines on your environmental objects (e.g. a rock).

    I.e. your bomb (or whatever else you want to use) will use a Search Tagged Machines node to get tagged machines in a defined range and a Start Tagged Machine node to start the found machines. Tagged machines define a number of tags that can start them, e.g. 'explosion'. That way you can control how things react to different events.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.