playMaker

Author Topic: Trigger Event not working when changing action owner  (Read 703 times)

EpicMcDude

  • Playmaker Newbie
  • *
  • Posts: 45
Trigger Event not working when changing action owner
« on: May 16, 2022, 06:08:13 PM »
Hello,

I'm having an issue of duplicate game objects using the same FSM not registering a trigger collision.

I was doing tests, and only the first weapon I pick up registers trigger collision as normal, but every other subsequent weapon I pick up does not register trigger collisions (I duplicated the 1st weapon so they're all the same/same logic).

In the screenshots you can see the triggers do make contact with the other colliders on the NPC, but only 1 weapon triggers the action event.

Am I doing something wrong with the logic? Feels like I'm missing something.

Thanks!


EpicMcDude

  • Playmaker Newbie
  • *
  • Posts: 45
Re: Trigger Event not working when changing action owner
« Reply #1 on: May 16, 2022, 06:08:51 PM »
The other picture that registers the event, using the 1st weapon I pick up -

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Trigger Event not working when changing action owner
« Reply #2 on: May 16, 2022, 09:58:11 PM »
on enable collider, try the check box 'All Colliders'

EpicMcDude

  • Playmaker Newbie
  • *
  • Posts: 45
Re: Trigger Event not working when changing action owner
« Reply #3 on: May 17, 2022, 07:23:30 AM »
on enable collider, try the check box 'All Colliders'

Even with All Colliders turned on, it doesn't register anything after the first weapon.
I've tested it thoroughly, and the Colliders works fine, all weapons get their trigger capsule colliders activated but the trigger after the first weapon never detect any collision.

I have no idea why this is happening, it's beyond me

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Trigger Event not working when changing action owner
« Reply #4 on: May 17, 2022, 09:20:30 AM »
Hi.
Oh your switching the object on the trigger actions.

it because trigger events needs some components that are created on the targeted object the first time (OnPreprocess).

What you can do is add a fsm on the weapons,
Set a trigger enter and a trigger exit (loop back and forth to each other)
and add a Set Bool Value on both states and call it for example InTrigger

Then on you main fsm (where the trigger event is now) do a Fsm Bool Test instead of the trigger event.

its because trigger scripts need to be on the object directly (a Unity Limitation)
But i do think that it should be mentioned on the action info

A other solution would be using OverlapCollider, but i noticed there are only actions for it for Array Maker.
I will look if i can make an/some action(s) for it this weekend.

EpicMcDude

  • Playmaker Newbie
  • *
  • Posts: 45
Re: Trigger Event not working when changing action owner
« Reply #5 on: May 17, 2022, 10:57:19 AM »
Oh man, that was indeed the problem!
That little piece of info was exactly what I needed, no idea it was like that, but it would for sure be super helpful if that information were to be in the action info, even though it's a Unity thing.

Those Overlap actions would be awesome and a great addition to the ecosystem. If you do make the time to make them I'd be very grateful.

Thanks for the help!