So I'm working on a system to place buildings on terrain. One requirement to place a building is that there be no other objects in the way (from certain excluded layers -- like trees, characters, etc.). So I put a trigger collider on the building game object being placed, to check for the presence of any excluded objects. This check needs to happen constantly, so I use a tick machine. I want to ask Makinom/ORK to do the following, but can't figure out which nodes to use...

"Hey, Makinom, please check if there are any objects from the excluded layers inside the trigger collider, and if yes, set the global boolean variable isObjectBlocking to true. If no objects from the excluded layers are inside the trigger, set isObjectBlocking to false."

How do I make the schematic check for objects inside the trigger collider?
  • Well, there is no default functionality for that available (also not in Unity). For some checks, there is e.g. the Shapecast node to check for standard geometric shapes (e.g. box) or some collider nodes to check if bounds intersect with another object's bounds - but nothing to get the objects currently within a collider/trigger.

    For something like that, you'd need to handle that with 2 Trigger Machines storing/removing the game objects entering/leaving the trigger in selected data (e.g. via object variables on the game object).
    In short:
    - trigger enter start > stores the object that started the machine into selected data on the game object
    - trigger exit start > removes the object from the selected data
    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.