playMaker

Author Topic: Possible to check what side a "On Trigger Exit 2D" happens?[SOLVED]  (Read 1248 times)

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
    • View Profile
Hi!

I wonder of there is a way to check what side/where the exit happens on a 2D collider with On trigger exit.

Right now the action can only tell if the game object left the collider or not, but there is no way to get more information about the exit.

I have a 2d sides crolling game and I want to check if my player left the trigger collider to the right or to the left, is this possible?

/ Christian
« Last Edit: November 12, 2019, 07:41:59 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15495
  • Official Playmaker Support
    • View Profile
Re: Possible to check what side a "On Trigger Exit 2D" happens?
« Reply #1 on: November 08, 2019, 08:39:01 AM »
Hi,

 unfortunatly no, there isn't any built in way to know that,

I would experiment with making a collider out of several ones, as child of your gameobject, each would represent a side, you have an fsm on each, and they know what they represent, they can then bubble the collision event to its parent and mention which side it is.

Bye,

Jean

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
    • View Profile
Re: Possible to check what side a "On Trigger Exit 2D" happens?
« Reply #2 on: November 08, 2019, 08:53:34 AM »
Hi,

 unfortunatly no, there isn't any built in way to know that,

I would experiment with making a collider out of several ones, as child of your gameobject, each would represent a side, you have an fsm on each, and they know what they represent, they can then bubble the collision event to its parent and mention which side it is.

Bye,

Jean

I see. Interesting idea Jean. I'll try that one out, thanks for the advice

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15495
  • Official Playmaker Support
    • View Profile
Re: Possible to check what side a "On Trigger Exit 2D" happens?[SOLVED]
« Reply #3 on: November 11, 2019, 04:51:39 AM »
Hi,

 been thinking about this and I think it deserves an action for this. I made a new action called GetTransformPointSide which will be generic enough to work for any scenario, should you want to know which side an object is compared to another or if you want to know the side of a collision.

Let me know if that works for you.

Bye,

 Jean

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
    • View Profile
Re: Possible to check what side a "On Trigger Exit 2D" happens?[SOLVED]
« Reply #4 on: November 12, 2019, 05:02:08 AM »
Hi,

 been thinking about this and I think it deserves an action for this. I made a new action called GetTransformPointSide which will be generic enough to work for any scenario, should you want to know which side an object is compared to another or if you want to know the side of a collision.

Let me know if that works for you.

Bye,

 Jean

Sweet! This works wonders! I also like that it is generic enough to work in alot of different scenarios. Great job!