playMaker

Author Topic: Trigger Enter events not happening past initial trigger.[SOLVED]  (Read 2202 times)

mphilips

  • Playmaker Newbie
  • *
  • Posts: 8
Hey guys.

I'm making a 2D Game.

I have a power up that, when the player touches, triggers a shockwave animation using 2d tool kit actions.

I'm trying to kill all enemies that are hit in the shockwave, as the shockwave hits them.

Here's how I tried to do it (I'm still new so bear with me).

- Character has rigid body (no grav. IsKinematic) + box collider + tag player
- Enemies have box collider with trigger + tag Enemy
- Power ups have box collider + trigger + tag Power up

Once player hits shockwave power up - I get power up collider component and remove trigger and add rigid body that has no grav. and IsKinematic. (So detection should function the same as Character, right?).

At this point I tried both a trigger event and a global trigger:

Trigger event: I checked if the trigger was the player, if so, I checked if the power up had been activated and looped back to the wait for trigger event. It only went through once and never detected enemies.

Global Trigger: Only triggered once unless I started the power up with rigidbody + not a collider trigger. If I did this, it would explode at the start of the scene (it was on top of enemies) but it would technically work and record multiple trigger enters. (had an int counter that increased each time).

So, any ideas? Am I going about this the right way?

Also, using 2D Tool kit - the box collider increases with each frame as the animation gets larger. Can I keep it this way and count on the larger box collider to grab new enemies as the animation gets bigger and touches them?

Any help would be great!

« Last Edit: July 22, 2014, 05:06:45 AM by jeanfabre »

mphilips

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Trigger Enter events not happening past initial trigger.
« Reply #1 on: July 17, 2014, 05:26:19 PM »
Just bumping to see if maybe my explanation didn't make much sense?

Should a trigger enter event only take affect once until the current trigger exits? or can I have multiple objects triggering at different times even while existing trigger objects are still touching the collider? (Like balls flying into a net triggering a score each time while leaving the current balls in the net after scoring).

The only other thing I can think of is an issue where the player touches the power up and starts a trigger event and then when I change the power up components, it doesn't properly register because it is currently in a trigger event still from the player touching it?

Hope that makes sense. I'll try making a new game object spawn as the shockwave instead and see if that works. But if anyone has any ideas that would be great!

mphilips

  • Playmaker Newbie
  • *
  • Posts: 8
Re: Trigger Enter events not happening past initial trigger.
« Reply #2 on: July 19, 2014, 08:26:54 PM »
Well, I solved it. Turned out it was an issue with 3D Physics. I'm still not sure why but the moment I switched over to 2D, all the trigger enters took affect and it worked perfectly.