playMaker

Author Topic: Trigger 2D event problem[SOLVED]  (Read 4611 times)

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
Trigger 2D event problem[SOLVED]
« on: June 28, 2018, 06:40:09 AM »
Hi all,

I have come across some problem with '2D trigger event' action...
I'm using the action to control my enemies, so setting is 'on stay' and sent event to attack the player (I've made sure checking the 'is a trigger' box).
The problem is it only trigger the 'attack' once, then the enemy will just hover on the player and do nothing. Only when the player makes a move, then it will trigger the attack again.
I've also tried using both 'on enter' and 'on stay' and it didn't make any difference.
Another thing I tried is to use '2D collision event' and the function works well. But What I need is for the enemy to just have the trigger collision shape with no rigid body.
Could anyone help to solve the problem?

Thanks,
M
« Last Edit: July 05, 2018, 12:24:41 AM by djaydino »

verybinary

  • Junior Playmaker
  • **
  • Posts: 81
    • The Museum of Digital
Re: Trigger 2D event problem
« Reply #1 on: June 28, 2018, 09:07:19 AM »
sounds like a state flow problem?
any chance you could upload a screenshot of where the fsm gets stuck?

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
Re: Trigger 2D event problem
« Reply #2 on: June 28, 2018, 10:06:45 PM »
Hi verybinary,

Thanks for your comment.
I've attached 2 x screenshot, please see if you can tell anything wrong.
I don't think it's a state flow problem as the function works fine when I used 2D collation action. The problem only exists when I turn the object into a trigger and use 2D trigger event action.

everyone else, please help to have a look as well.

Thanks,
M

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
Re: Trigger 2D event problem
« Reply #3 on: June 29, 2018, 03:47:42 AM »
I spent several hours more on this but still couldn't figure out the problem.
It's like the 2D trigger on stay only triggers the action for one frame. Shouldn't it be triggering the action for every frame like collision 2D event?
Could it be bugs?

Please help me out someone, it's really killing me.

Thanks a lot.
M

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Trigger 2D event problem
« Reply #4 on: June 29, 2018, 07:25:54 AM »
Hi.
I can see only 1 image.

there might be an infinite loop, but i need to see the complete actions on both states to see what is going on :)

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
Re: Trigger 2D event problem
« Reply #5 on: July 01, 2018, 10:13:10 PM »
Hi djaydino,

I attached two screenshots here, please help to have a look.

Thanks!
M

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Trigger 2D event problem
« Reply #6 on: July 02, 2018, 07:33:00 AM »
Hi.
For triggers you need to use 'Trigger Event' on your image i can see that you are using 'Collision Event'

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
Re: Trigger 2D event problem
« Reply #7 on: July 03, 2018, 06:28:26 AM »
Yes, I'm currently using collision event as trigger even on stay is not working.
I used exactly same setting for trigger event and checked 'is trigger' box, but it only triggers attack once. I have to move my player then it will trigger the enemy attack again.
Could you possibly tell what the problem could be?

Thanks!
M

DanielThomas

  • Beta Group
  • Full Member
  • *
  • Posts: 150
Re: Trigger 2D event problem
« Reply #8 on: July 03, 2018, 06:51:31 AM »
Not going to add much here more than I had similar problem with the "on stay" not working unless it's actually moving. It's like if the object inside trigger is not moving it's not updated. So possibly you could play around with the rigidbody settings.
Could you post a screenshot of the objects inspector as well?

verybinary

  • Junior Playmaker
  • **
  • Posts: 81
    • The Museum of Digital
Re: Trigger 2D event problem
« Reply #9 on: July 03, 2018, 11:23:57 AM »
Im on a similar tangent as @DanielThomas. there does seem to be "issues" involved with player movement.
try a copy of the trigger event right under the original and change it to trigger enter?

or you might have to just switch that out for a raycast from the enemy to detect the player

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Trigger 2D event problem
« Reply #10 on: July 03, 2018, 01:13:10 PM »
Hi.
I made a video trying to repo but it seems to work fine here.

Using unity 2018.1.3f1 and PlayMaker 1.9.0p3


DanielThomas

  • Beta Group
  • Full Member
  • *
  • Posts: 150
Re: Trigger 2D event problem
« Reply #11 on: July 03, 2018, 07:08:31 PM »
Note that he's using 2D, which I also did when I had the problem. The rigid body 2D has a few different options like Dynamic, static etc. So it would be good to see the object's inspector.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Trigger 2D event problem
« Reply #12 on: July 03, 2018, 07:36:42 PM »
Hi.

Oops thank for noticing, i will test on 2D.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Trigger 2D event problem
« Reply #13 on: July 03, 2018, 08:04:17 PM »
Hi.
I can Confirm this.
It only triggers 'on stay' while object is moving.

Tried on u5.6.4 and latest official.

I will contact Alex.

QueenM56

  • Junior Playmaker
  • **
  • Posts: 55
Re: Trigger 2D event problem
« Reply #14 on: July 03, 2018, 10:16:11 PM »
Thanks guys,

Here is the screenshot of the inspector.
Please see if there is anything I should adjust.

Cheers,
M