playMaker

Author Topic: Trigger on 2nd object in array not triggering.  (Read 689 times)

curb47

  • Sr. Member
  • ****
  • Posts: 256
Trigger on 2nd object in array not triggering.
« on: March 06, 2021, 02:31:28 AM »
Hello again,

So I've got another problem. Nothing new there then.

It kinda follows on from my other thread about Array Get Next not working. I've re-worked the array set-up, so the Array list is formed on the Sentient, and not the COMETS game object. This seems to work.

So... an Array is set, consisting of 3 objects. These objects are empty game objects that have a Sphere Collider set as Trigger. The idea is, when the sentient spawns, it grabs one of the objects from the list and moves towards to. When it reaches the object, the Trigger tells the sentient to get the next object on the array list and move to that one, etc etc. It just sets up a simple loop of the sentient moving around the scene.



As the game starts, the first target (named worldRed1) is grabbed from the array, and it works as expected...







And when the Sentient enters the Sphere Collider Trigger on target 1, it sends the event and grabs the next target (worldRed2) on the array list... All good so far...



The next target is then set in the Look At action, and is set in the Trigger Event action. This works.



And the sentient now moves towards target 2...




And now, the fail...

When the sentient enters the Sphere Collider Trigger of target 2, the Trigger event is not being registered/sent. The sentient just sits inside the sphere and continuously bobs around.



When the sentient enters the Trigger Sphere for target 2, it should send the 'go' event and grab the next object on the array, which is target 3 (worldRed3).

I don't understand how the system works just fine for the first target, but doesn't work for the second target. The logic is solid, and the game object targets are identical, just an empty object with a sphere collider:



If the logic works for target 1, it should work for the entire loop, right?

Please can somebody help me out here (again)... my brain is fried from all this logic problem solving.

Many thanks,

J.

 
« Last Edit: March 07, 2021, 06:28:35 AM by curb47 »

curb47

  • Sr. Member
  • ****
  • Posts: 256
Re: Weird Trigger behaviour... confused again!
« Reply #1 on: March 07, 2021, 01:40:15 AM »
Sorry... gotta bump.

Bump.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Trigger on 2nd object in array not triggering.
« Reply #2 on: March 08, 2021, 06:02:27 AM »
Hi.
I think changing targets on trigger events might not work well.

But maybe its better you use a 'Get Distance' and a 'float compare'.
This uses less resources than triggers.

Or have a trigger fsm on the worldred gameobjects and do a send event.

curb47

  • Sr. Member
  • ****
  • Posts: 256
Re: Trigger on 2nd object in array not triggering.
« Reply #3 on: March 09, 2021, 01:41:54 AM »
Hello,

I tried the trigger fsm on the worldred objects and that seems to work, but has opened another set of problems.

You say Get Distance & Float Compare uses less resources than triggers? I'm surprised. I'll gladly use get distance, much simpler.