Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: utopien on February 01, 2018, 04:24:56 AM
-
Hello I made a rope:
in each link is the child of the parent rope
what i want to do : is being able to store each link
the Player already have to link which his hanging So from there I get the parent on the link then what then i would like to do is get all the children's in order I need to get uplink and downlink because I want to use a move toward to get to the next link either up or down.
He get the next uplink and if I push down to downlink so a somewhat have an ID about how I can do that I would really appreciate
All my link have a number on the hierarchy which correspond to there order
-
Hi, to get all the children and store them, you need an array. An array acts like a list of game objects (or other things).
You will need to create a loop using playmaker.
You will need to use the action "Get Child Number". Number 0 will be the first child. So start with an Int Variable (maybe called myChildNumber). Set it to 0. Then add 1 each time after you finish getting the child and saving it to an array.
Each time check if the child is null. (Because once you are done getting all the child, the last one will be null). When Get Child Number returns null, then you can stop adding gameobjects to your array.
Once you have all of them in array. You can easily count up or down the chain to get any link you want.
-
Thank you for your reply I was able to do such by getting my getting on the trigger enter I stored collider as a game object then I used action get all array child and from there I get all the links on the rope what they do not how to say is to know where the game object I'm on is listed on the RA list and how to get the link before and after to be able to move up or down here a more detailed explanation
I made a rope which each link is under the parent game object cald rope and then each link is called Link(1),Link(2) ext ext........
when the player grab a link of the rope he store the link gameobject on the trigger enter for the sake of the example let's say there is 10 links and the player grabbed link (5) ;
what i want to do from there is being able to store Link (5)
and being able to get Link Before (4) and Link after (6) to move on the rope either up using Move toward which would be link (4) or moving down toward link (6) I need to be able to say i am on the link number five ? and need to be able to get the previous ? one and after one ?
I watch...
some video on YouTube ontreat that subject, but not of what I have seen seems to answer my question I'm in new with Array so maybe that's the problem
Thanks
for any help you can brought are just trying to thanks a lot.