I’m trying to make an AI Character follow a Spline and I’ve come up with this setup:
Using the GetWorldLocationAtDistanceAlongSpline-function I get a location somewhere on the Spline to which I can send my character using the BehaviorTree’s “MoveTo” node, which automatically enables it to use the NavMesh to navigate around obstacles as well as play the run animation. Once the character has reached the location on the Spline, I increase the “distance along the spline”-variable and send him to a location 3 metres further down the Spline and so on.
This is working as expected, the problem I’ve ran into though is that the character shortly stops every 3 metres before proceeding to the next location. I’ve unchecked the MoveTo-node’s “Stop at overlap”-checkbox but it’s not making any difference.
EDIT: Here’s a link to a video in which I’ve recorded the issue for better understanding.
I tried to do that at first with the “Acceptable radius” variable of the MoveTo node but realised why this wouldn’t change anything of course. The most straight-forward solution now seems to me to check the distance to the location in for example the Bot’s Tick function and call the function that sets the next location from there. Can you show me where you would implement the service you suggested on the attached screenshot
though? The part that handles movement with the Spline is the branch on the left.
Thanks
EDIT: I tried it with my solution but it looks just the same as before. I set the new location when the bot is <= 2.5m away (DistanceToSetNextLocation = 250.0f)
The service would go to the “Spline is Set” sequence, you can create new service by clicking the rightmost button,near new decorator(I reused old blackboard so there enemy instead of spline in the decorator).
You can also do this with Simple Parallel node but you’d need to rewrite yout Advance task to check Character’s distance to spline point
In the Simple Parallel solution the main task should be Advance , the subtree Move To (so Move To gets updated location). Also make sure that acceptable radius of Move To is lesser than DistanceToSetNextLocation
edit:
If this won’t work you can also try spawning an invisible actor following spline and setting the Character to follow that Actor. the Actor should stop when the character gets too far and start again when it gets near enough (again the acceptable radius for Character must be lesser than what Actor uses to start moving)