playMaker

Author Topic: Collision 2d Event triggered by all 2d colliders  (Read 2598 times)

SOMRH

  • Playmaker Newbie
  • *
  • Posts: 2
Collision 2d Event triggered by all 2d colliders
« on: April 01, 2015, 07:31:09 AM »
Hi all,

I'm having a hard time understanding how the 2d Collision event works. In order to obtain 2d collision info from an enemy attack, I need to use the COLLISION ENTER 2D. If I use a local trigger, no collision is obtained.

Here's my problem. The COLLISION ENTER 2D event is triggered by all colliders. All of the objects that have colliders all have the 2d proxy script (marked in red).

How can I set it up so that I can still get the collision info from the enemy but have it so that the walls do not trigger the the FSM?




jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Collision 2d Event triggered by all 2d colliders
« Reply #1 on: April 01, 2015, 10:04:39 AM »
Hi,

 If you have colliders as childs of a parent that also has a collider, then yes, the parent will received the trigger of the child too.

 Is that the case or do I mis understand your setup?

 Bye,

 Jean

SOMRH

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Collision 2d Event triggered by all 2d colliders
« Reply #2 on: April 01, 2015, 11:04:49 AM »
I meant that everything, including the walls are registering as a triggered event. For example, if I walk the player to a wall (tag:wall) and it collides, the FSM on the player fires a COLLISION 2D EVENT (a global event) even though I set the collide tag to "enemy damage."

If I attempt to use a local trigger, the collision works perfectly but I am unable to obtain any 2d collision info from the "enemy damage" tag.


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Collision 2d Event triggered by all 2d colliders
« Reply #3 on: April 03, 2015, 05:39:09 AM »
Hi,

 Ok, I see. I did not distribute these actions cause I wanted to wait for 1.8 and the new fsmEnum, but I guess it's ok. I have pushed them on the Ecosystem

 so you'll have now two new actions working like their 3d counterpart. I suggest you get them via the Ecosystem, it's faster, but here's the links to the github if you need it.

Collision2dEvent

GetCollision2dInfo

 so you can either keep receiving all collisions and use GetCollision2dInfo to filter out by tag or use Collision2dEvent in place of the global events and be notified just for your specified tags.

Bye,

 Jean