playMaker

Author Topic: Make an enemy trigger an event when he reaches the player??  (Read 3158 times)

XilenceX

  • Playmaker Newbie
  • *
  • Posts: 11
Hello,
I am currently in the process of setting up the enemies in my game. I am using RAIN AI to move the enemies and play movement mecanim animations this works very well.
I can also play the attack animation for the enemy with a simple Set Animator Bool Playmaker action (Tested by Alt-Clicking that state to activate it).

 
I thought the hardest part is done, but I have one huge problem!
I can not figure out how to TRIGGER the state where the attack should start.
My ideal situation would be to have one huge trigger area attached to the player and once an enemy enters it they go to the attack state.
However I have tried pretty much everything... from colliders to special tags to rigidbodies... nothing enables my enemies to set off that trigger and fire an event.

Here is a screenshot that shows the flawed situation for the trigger:


To doublecheck I have also created a trigger (that ugly gray box) arround the enemy, which in my mind should also fire off in this situation. However as you can see it doesn't:


Please note that the tags on the objects seem to do nothing, so I have set all to Finish atm, but they could also be Untagged or Player or whatever. Nothing works.
So pretty please... help. Preferrably with a step by step guide how to solve this madness.  :-[
« Last Edit: July 01, 2013, 07:24:40 PM by XilenceX »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Make an enemy trigger an event when he reaches the player??
« Reply #1 on: July 02, 2013, 02:38:17 AM »
Hi,

 it's likely a set up problem with your collider. At least one of the collider must have a physics component

 can you create an empty scene, have a one cube on top of another, and a fsm attach to them and check for trigger events. Until you can't figure it out here, keep at it, once you understand how to set up your colliders, then you can apply it to your ennemies.

 Also, check out the various sample provided with playmaker, especially the noExit sample, it's all about triggers.

 Bye,

 Jean

XilenceX

  • Playmaker Newbie
  • *
  • Posts: 11
Re: Make an enemy trigger an event when he reaches the player??
« Reply #2 on: July 02, 2013, 08:10:34 AM »
Thanks for your help Jean. The same situation just with boxes and/or the player has always worked fine. However I couldn't get the AI conrolled enemy to work. Having said that I found a solution now by adding a character controller to the enemy. I am not sure if this is a good solution, given that I don't expect to need it for anything else. However the triggers would not activate with any other physics component applied to the enemy, including rigidbodies. *sigh*

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Make an enemy trigger an event when he reaches the player??
« Reply #3 on: July 03, 2013, 02:09:39 AM »
Hi,

 that's odd indeed. In your case, you need to isolate the problem down to the bear minimum.

remove things until it starts behaving basically. For example, have only one enemy and one player, and then mess with it, and study their set up ( collider, physics) etc. Maybe they are on a different physics layer, or simply disabled, etc.

bye,

 Jean