How to make AI not stop at MoveTo location

Hi everyone!

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.

change Move To’s location when your character is close to the point but not quite on it (for example in 1m radius) you can do it in subtree service

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 :slight_smile:

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)

void ABot::Tick( float DeltaTime )
{
	Super::Tick( DeltaTime );
	
	DistanceVector = GetActorLocation() - LocationOnSpline;
	if (DistanceVector.Size() <= DistanceToSetNextLocation)
	{
		AIController->AdvanceLocationOnSpline();
	}
}

PS: Since I set the new location in the Tick function now I also removed the task from the BT.

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).

95240-behaviourtree2.png

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

95251-behaviourtree1.png

Okay, I’ll give it a try. Thanks for your detailed explanation!

EDIT:
Tried it with the service now, still looks the same as with the other attempts. I’ll update once I tried it with Simple Parallel.

void ABot_WaypointController::AdvanceLocationOnSpline()
{
	Bot->DistanceVector = Bot->GetActorLocation() - Bot->LocationOnSpline;

	if (Bot->DistanceVector.Size() <= Bot->DistanceToSetNextLocation)
	{
		DistanceOnSpline += SplineDeltaDistance;
		Bot->LocationOnSpline = Bot->SplineComp->GetWorldLocationAtDistanceAlongSpline(DistanceOnSpline);
		UpdateBlackboardSplineData(Bot->SplinePath);
	}
}

EDIT 2:
The Simple Parallel solution also looks exactly the same. All the 3 methods make the Character stop periodically on the line.

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)

Ooooh that’s brilliant I’ll try that!