Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Tremzoff on July 05, 2016, 05:08:31 AM

Title: Object hit or nothing hit
Post by: Tremzoff on July 05, 2016, 05:08:31 AM
Hello guys

I am stuck. So I need some fresh input :-)

Here's the situation:

I am touch dragging an object (in 2d). After the touch ends it shall check wether another object is hit at the current position or nothing is hit:
If "hit" -> do this, if "not hit" -> do that.

I tried with trigger 2d and conditional expression, but this is only triggering if actually something was hit and not if nothing was hit....

Regards
Title: Re: Object hit or nothing hit
Post by: Tremzoff on July 05, 2016, 06:56:57 PM
I found a solution: I just added an invisible background with a collider, so that the object always collides either with the background (same result as "has not hit") or the other objects (result "has hit"). Works as intended now.

Regards
Title: Re: Object hit or nothing hit
Post by: Zeldag on July 06, 2016, 02:57:00 PM
Hi,

I see you have solved it, but I was just wondering how you get to the state where you check if you hit something.

Just thinking that if it is not just a start state but it transitions into it when you'll stop dragging, then you can just put a tiny 'wait' action (for like 0.01) after the trigger event action (or maybe even a 'next frame event' action?).

The' trigger event' sends the 'hit' event, the 'wait' sends the 'no hit' action.

I hope the solution you used is working well for you, otherwise I think this alternative would work well in most cases.

Good luck, hope this helps!