Hi

I have a prefab that's acting as an item to be collected. I can make it work when the Item Collector on the prefab is set to Collision Enter but not when it's set to Interact. The prefab has a 2D Box Collider attached to it.

I have a player prefab who has a 2D Interaction Controller added to it. The player also has a 2D Box Collider assigned to it.
I've tried setting the 2D Interaction Controller on the player to be in the middle of the player, and also just in-front of him/her/it.

The Interaction Controller settings in Ork are set to "Add automatically" = Disabled. "Max Click Distance" is set to 3.

I'm interested in knowing where I've gone wrong as I'd just like to be able to walk up to an item and hit the Accept button (I've changed it to spacebar) to trigger the item being put into the inventory.

Olly

  • Hm, try setting up the interaction controller as a child object of the player - and make sure there's a rigidbody 2D on the same game object.
    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!
  • Thanks.

    I have a rigidbody 2D in place, and the interaction controller is a child of the player.

    Here's a screenshot of my player properties.

    https://drive.google.com/file/d/1NM4ssZZNOhq0Yrh3bvnUR3NwiH2-eIq9/view?usp=sharing
  • I've also tried adding the Interaction Controllers as child objects to both the Player and the item prefab.

    https://photos.app.goo.gl/5pEDzxfQT4xY3F68A
    https://photos.app.goo.gl/59DacnKoJbXnhX3p8
  • edited November 2019
    Your collider isn't set up as a trigger. The interaction controller works by recognizing interactions that enter and leave the collider, which requires it to have Is Trigger enabled :)

    In short - you can only interact with stuff that's within the Interaction Controller's trigger collider.
    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!
  • Yeah I realise that that first screenshot was misleading. It was of my player prefab, so his 2d collider wasn't a trigger (otherwise it doesn't collide with tiles).

    I've tried setting the trigger boxes on the colliders of both the collector of the item (the thing being collected), and the collider of the player.

    See these.
    https://photos.app.goo.gl/uuDCAJcsNaJW9ebe7
    https://photos.app.goo.gl/XLTXjj4f9WHkepcM7

    I'm not sure if this is important, but clearly I'm using a custom player controller for the player, and my script only looks at movement (up, down, etc). Should my controller be looking out for the spacebar (accept) and calling something in ORK or will ORK be handling that? I've set Accept to spacebar in the ORK settings.

    Olly


  • edited November 2019
    Could you show your player (scene view) with colliders/gizmos visible?
    Also, please post the the other added components as well :)

    Interactions work if:
    - your player has an Interaction Controller, a Collider (as trigger) and a Rigidbody (in your case in 2D versions) attached, either on a child object or directly on the root
    - an interactable (i.e. start type Interact) game object is within the interaction controller's trigger and recognized by Unity's physics system (i.e. trigger enter)

    Pressing the Interact Key will start an interaction of something within the interaction controller's trigger. If the inspector of the IC doesn't show anything interactable, the interaction is not being recognized by the physics system.
    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!
  • Thanks

    Will post some screenshot.

    Certainly the IC is picking up the nearby interactions as the inspector shows one available nearby interaction. However even with this showing, hitting space and Enter doesn't do a thing (space being the specified interact key).


  • Hm, the setup looks correct ... the only other thing I could think of is your player not being spawned through ORK (or not known to ORK), so the IC isn't found.

    Could you send me a small Unity test project with your setup to contact@orkframework.com? E.g. upload it on dropbox and send me the link :)
    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!
  • Definitely being spawned by Ork. THere's a spawn point (0) and no player object is on the scene prior to runtime, and no code (that I've put in place) to spawn the player.

    Will send you a google drive sharing link via PM.
  • For others running into this problem:

    Make sure your ORK game is running - either going through a main menu (starting a new game or loading a saved game) or using a Game Starter in your scene with Start Game enabled (see this how-to for details).
    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!
  • Ah wonderful. Thanks for the help.
Sign In or Register to comment.