I'm making a top-down 2D game and I have written my own controller for the player prefab which automatically moves the Interaction Controller one tile in front of the character whenever it moves.

The player gameobject contains a gameobject called "IC" in which the interaction controller is added by ORK and the character controller keeps this object always in front of the player.

The player has a 2D collider around itself, the interaction controller prefab has one too.

If I make an event that is supposed to be activated by the IC (Interact mode) everything works fine: the character gets in range and then the event only activates itself when the interaction button is pressed.

Problems arise when I try to make a trigger enter event, for example an area change that is supposed to activate only when the player walks on it.
In this case the event gets activated prematurely by the IC's collider, rather than the player.

I tried to change the "is trigger" setting of the colliders but I couldn't find a combination that managed to work properly: disabling the trigger on the IC collider does prevent the "trigger enter" events from triggering but it also completely prevents Interaction events from being triggered, which I do not want to happen.

How do I set this up properly?
  • edited January 2016
    Disable the Start By Root Object option in the interaction's component inspector. When enabled, the interaction will check if the root of the entering object is the player (or another object, depending on the setup).
    Post edited by gamingislove on
    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!
  • I just checked and it seems that option was never enabled to begin with.
    But turning it on seemed to have fixed it, which is weird because I remember trying it before without success.
    Thanks for the tip!
  • Yeah, sorry, got it the other way round - Start By Root Object ensures that the checked object is the root game object and not a child (e.g. the interaction controller) :D
    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.