Skip to main content

random_selector

Function random_selector 

Source
pub fn random_selector(name: &str, children: Vec<BehaviorNode>) -> BehaviorNode
Expand description

A Selector that shuffles its children randomly on each activation, then tries them in the shuffled order. Because the shuffle is computed per-activation (inside the tick closure), the node re-shuffles every time the selector restarts.

The children are pre-built BehaviorNode instances passed in. Internally this wraps them in a custom Leaf that drives them manually, maintaining its own cursor and shuffled order.