playMaker

Author Topic: Object hit or nothing hit  (Read 1373 times)

Tremzoff

  • Guest
Object hit or nothing hit
« 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

Tremzoff

  • Guest
Re: Object hit or nothing hit
« Reply #1 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

Zeldag

  • Full Member
  • ***
  • Posts: 198
Re: Object hit or nothing hit
« Reply #2 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!