Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: szomaza on January 28, 2019, 05:48:34 AM

Title: Collision2DEvent fires when hitting platform from below[SOLVED]
Post by: szomaza on January 28, 2019, 05: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
Title: Re: Collision2DEvent fires when hitting platform from below
Post by: jeanfabre on January 28, 2019, 07: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
Title: Re: Collision2DEvent fires when hitting platform from below
Post by: szomaza on January 28, 2019, 08: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 (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.
Title: Re: Collision2DEvent fires when hitting platform from below
Post by: jeanfabre on January 29, 2019, 03: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
Title: Re: Collision2DEvent fires when hitting platform from below
Post by: szomaza on February 09, 2019, 11: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.
Title: Re: Collision2DEvent fires when hitting platform from below
Post by: jeanfabre on February 15, 2019, 03:23:42 AM
Hi,

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

 I have attached them here.

 Bye,

 Jean
Title: Re: Collision2DEvent fires when hitting platform from below
Post by: szomaza on February 16, 2019, 03:24:51 AM
Thank you very much.

The IgnoreDisabled possibility in the Collision2DEvent works perfectly.