playMaker

Author Topic: Collision2DEvent fires when hitting platform from below[SOLVED]  (Read 483 times)

szomaza

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Collision2DEvent fires when hitting platform from below[SOLVED]
« on: January 28, 2019, 03:48:34 AM »
Collision2DEvent on the projectile fires when hitting platform from below, even though the platform has Platform Effector 2D set to use one way.

Everything else, like player and dynamic blocks behave well with the platforms but projectiles, when shot from below the platform register a Collision2DEvent.

Is this a bug or just a limitation of the Collision2DEvent action?
I was expecting the projectiles to also go through the platform from bellow and only fire the Collision2DEvent when falling back onto the platform from above.

I am not sure how this should work.
If this is just a limitation of the Collision2DEvent then how should I add the part to make it take the Platform Effector 2D into consideration?

Thanks in advance,
szomaza
« Last Edit: February 25, 2019, 12:49:30 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14338
  • Official Playmaker Support
    • View Profile
Re: Collision2DEvent fires when hitting platform from below
« Reply #1 on: January 28, 2019, 05:51:37 AM »
Hi,

 where did you get this PlatformEffector2D from? It's likely a custom system so yes it will need to be taken into consideration, maybe it has already some callbacks to create new actions for it or a new proxy.

Bye,

 Jean

szomaza

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Collision2DEvent fires when hitting platform from below
« Reply #2 on: January 28, 2019, 06:35:09 AM »
Sorry, I did not explain properly.
The Platform Effector 2D is a built in Unity component:
https://docs.unity3d.com/Manual/class-PlatformEffector2D.html

It is used in 2d platform games, so the player character does not hit the platform (with Edge Collider 2D) when jumping up from bellow, but will not fall through the platform from above.

This works nicely, but when I shoot a projectile which has an FSM with Collision2DEvent, this event fires even when the projectile should be going through the platform from bellow.
« Last Edit: January 28, 2019, 06:39:13 AM by szomaza »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14338
  • Official Playmaker Support
    • View Profile
Re: Collision2DEvent fires when hitting platform from below
« Reply #3 on: January 29, 2019, 01:25:55 AM »
Hi,

 oh, ok, I just learned a new thing in Unity :)

https://forum.unity.com/threads/collision-with-platform-effector-2d.420304/

so there is a property called Enabled which indicates if the collision has effect or not on the gameobjects, this is what's missing here for you.

 I have updated the action GetCollision2dInfo so that know you can get the enabled property,you will still receive the global system events.

I also updated Collision2dEvent which allows you to catch only enabled event, I added a new property to let you ignore disabled events.

 Let me know how it goes, and if all is ok, it will make it to the next version of PlayMaker ( and I'll shout out on the forum about this)


Bye,

 Jean

szomaza

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Collision2DEvent fires when hitting platform from below
« Reply #4 on: February 09, 2019, 09:04:51 AM »
That makes sense.
Thanks Jean for investigating and the improvements, but where do I find the updated versions?

I don't find them on the Ecosystem and the versions I found on Github are the old ones.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14338
  • Official Playmaker Support
    • View Profile
Re: Collision2DEvent fires when hitting platform from below
« Reply #5 on: February 15, 2019, 01:23:42 AM »
Hi,

 yes, they are in the playmaker source ready for the next release.

 I have attached them here.

 Bye,

 Jean

szomaza

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Collision2DEvent fires when hitting platform from below
« Reply #6 on: February 16, 2019, 01:24:51 AM »
Thank you very much.

The IgnoreDisabled possibility in the Collision2DEvent works perfectly.