StartStopAbility - SpeedChange flips from walking to sprinting

bbjones

Member
I have a simple external BD Tree that I add to my AI agent at runtime.

1573746019638.png

I have code to right click, cast a ray, create a game object (waypoint prefab) at that position, then set a BD Tree shared variable with that new waypoint prefab which sets the Seek task target, then disables and re-enables the BD tree to restart it.

This works as expected. I can right click endlessly and the AI agent will change direction to follow the new target on each click.

The AI agent starts the scene idle and standing still.
If I click once, the new waypoint is created, and the agent walks towards it.
If I keep clicking new waypoints slowly, the agent will keep retargeting on the latest waypoint and continue walking.
If I click twice quickly, which creates 2 new waypoints, the agent goes towards the last one as it should, but now runs.

What I don't get is how I made the agent run just by doing this quickly.

If I disable the StartStopAbility task, the BD tree still works, but the agent will only ever walk.

What I'm really after is how to tell the agent to run all the time when changing seek target.
 
What is your Speed Change start/stop type? Since you are controlling it with the behavior tree both should be set to manual.

Also, that behavior tree is going to stop when the Seek task is complete. After seek I would run Start Stop Ability again, this time stopping the Speed Change ability.
 
Top