Hi there, I’m working on a little project and I have some problems
1) I have like 40 points in my map, so I choose one walk there, stop-wait idle, then again move to a place, when there stop-idle. The problem is that if I put animations repeat forever so that the walk and the idle play normal, the node of animation walk never return, to fix it for “the moment” I have put it as “once”. The character is not a mecanim.
2) having 40 points and selecting each one with a random and having 40 sequences is painful specially when I want to say… change the wait time of all the nodes instead of 5 seconds to 1 second.
I see that I can have a tree behaviour reference… but I can’t pass a variable so that I only do 40 references and pass that the first goes to first node, the second to the second and so on. I mean this references are more like a fixed thing copy/paste (template without parameters).
* Also like extra points I will like to know if it is possible to modify at runtime a behavior tree and how?
(1) Put the walk and the animation inside a parallel. Set the parallel to succeed on Any.
(2) Right. I wouldn’t put 40 different sequencers into a random node. I would instead choose the destination at random, then use a single move sequence to move to whatever destination was chosen. How are your points designated? Are they NavigationTargets? Fixed Vector3 positions? Stored in some array in code? Your tree should look like this:
ACTION (pick a destination at random. assign the destination to a variable like moveTarget)
PARALLEL (SUCCEED ANY)
— MOVE (Move Target = moveTarget)
— ANIMATE (Loops forever)
Yes, you can modify behavior trees at runtime. That said, I’ve only ever needed to do that once. Why do you want to do it?