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


  • Playmaker Newbie
  • *
  • Posts: 30
    • View Profile
Find fsm in parent?
« on: May 04, 2019, 10:35:16 AM »
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.


  • Administrator
  • Hero Member
  • *****
  • Posts: 4820
    • View Profile
    • jinxtergames
Re: Find fsm in parent?
« Reply #1 on: May 06, 2019, 02:52:19 AM »
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.