1. Hey! Guest! The 34th GMC Jam will take place between August 22nd, 12:00 UTC (Thursday noon) and August 26th, 12:00 UTC (Monday noon). Why not join in! Click here to find out more!
    Dismiss Notice

GMS 2 Interactive sensors

Discussion in 'Programming' started by Occupant, Aug 14, 2019.

  1. Occupant

    Occupant Member

    Joined:
    Aug 14, 2019
    Posts:
    2
    Hello,

    I am working on a generic interaction system (i.e. player collides with an interactive parent and can use an action button to trigger some script).

    This works fine when the interactive child is not a sensor, because I can detect the action button in the player's collision event with the interactive parent object, since the collision event is running every frame.

    However, when I try to build an interactive child object that uses the "sensor" property, the same collision event detection of the action button doesn't work. I'm guessing this is because the sensor (for some reason) only executes the collision on the initial overlap, so subsequently pressing the action button isn't noticed.

    Is there a way to customize the behavior of the sensor so that it can detect a button press during a collision with the player? It seems useful to be able to ask "if the player is standing on this sensor and pressing this button", but I can't see how to do it with the sensor working the way that it does.

    Thanks for any help!
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,661
    Are any of the instances involved marked as solid?
     
  3. Occupant

    Occupant Member

    Joined:
    Aug 14, 2019
    Posts:
    2
    No. They all use physics but none are marked solid. I did try marking each as solid, then both, but it didn't seem to change the way that the sensor triggered its collision event.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice