playMaker

Author Topic: Find fsm in parent?  (Read 1067 times)

Prestonh

  • Playmaker Newbie
  • *
  • Posts: 44
Find fsm in parent?
« on: May 04, 2019, 01:35:16 PM »
At the moment, i have a humonoid, that has colliders and such on their limbs, i can shoot an arrow, the arrow hits and parents. All looks good.  But the health script is on the root of the guy hit.   So, currently i get the root of what i hit and send the damage event to that. And it all works good.  But with my spawning system, for pooling and various other things, it would be a benefit to me to have the spawned npc be a child of the spawning system.   But, this causes me issues, because if i do that. I can no longer get root on target hit. Because the root would be the spawning system not the npc.   So, is there a way to find a specific fsm in parents?  Or a get root with name?   Or some way to easily find the npc root without getting the spawn system root?  I was debating on just putting a fsm on each limb more or less that receives the npc object. By having the npc main object send a event down to all its children saying. “Hey, send all damage to me” kind of deal.   But was thinking maybe soneone knows a easier way.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7614
    • jinxtergames
Re: Find fsm in parent?
« Reply #1 on: May 06, 2019, 05:52:19 AM »
Hi.
What i usually do if i use triggers/colliders as children's.
Add a fsm to the GameObjects and call it 'Data'

Then place a variable (call it Parent or Root for example) and drag/drop the parent in it.

Then on collision/trigger event i use 'Get Fsm GameObject' to get the variable on the Data fsm.