AI Move to, doesnt consider height in Acceptance radius.

So i ran into an Issu with the AI Movmement Node and Acceptance Radius. Basically the Ai moves around the slope and up it to shoot at the player instead of shooting from the ground below. I Think its related to the height as it works fine if the platform isnt higher than 200 units above the ground. But as soon as i exceed that the ai moves around the platform and up on it to reach the player instead. IM sure there is just a setting somewhere to accept the height somehow so appreciate any pointers. I Have the Z Value on query extent set to 2500 so I doubt its that. I Also tried with NAv Links and that didnt seem to work either.

So to clarify you can see on the picture, if the platform is higher than 200 units the ai will move around the platform according to the image and stop where the arrow stops to shoot.

Thanks in advance for any help!

so, you’re saying that if you lower the platform, then the AI will stand right where it is on the left, and shoot upwards, but if you raise the platform, then it will not?

That doesn’t have to do with your AcceptanceRadius, that has to do with your selection of MoveTo locations

Thanks for your reply! Yeah exactly, if I lower the platform it just starts firing. Im not sure i understand what you mean with “selection of move to location tho”. The BP Setup is pretty simple and the AI just gets the Player Character and then executes one move to node with the character as Target. The Acceptence Radius for that is 2500 so i feel like it should be “accepted” as soon as it fires with the level setup like this. But instead the Ai moves up the slope and when it goes up a little bit it can now shoot again. I’m not implementing any logic for Angle Threshold’s of shooting or stuff like that.

ooooh. using move to actor. i forget about that option, don’t use it much, sorry.

You could turn off pathfinding in the moveto, then it will just go straight at it until it gets within acceptanceradius.

If you were using behaviortree, you could write a service that checks distance disregarding the Z and abort the move if the distance is close enough. Can do the same thing on Tick or a Timer if it’s just in your AI Controller.

fwiw, here’s the code from 4.27 PathFollowingComponent::HasReachedInternal

	float AgentRadius = 0.0f;
	float AgentHalfHeight = 0.0f;
	AActor* MovingAgent = MovementComp->GetOwner();
	MovingAgent->GetSimpleCollisionCylinder(AgentRadius, AgentHalfHeight);

	// check if they overlap (with added AcceptanceRadius)
	const FVector ToGoal = GoalLocation - AgentLocation;

	const float Dist2DSq = ToGoal.SizeSquared2D();
	const float UseRadius = RadiusThreshold + GoalRadius + (AgentRadius * AgentRadiusMultiplier);
	if (Dist2DSq > FMath::Square(UseRadius))
		return false;

	const float ZDiff = FMath::Abs(ToGoal.Z);
	const float UseHeight = GoalHalfHeight + (AgentHalfHeight * MinAgentHalfHeightPct);
	if (ZDiff > UseHeight)
		return false;

	return true;

examining that should tell how it determines it…

Probably a better/more realistic option, would be to use a EQS query to find a good location where the target is visible and you can shoot from, then MoveTo with a location on that, instead of having it chase the pawn and hope radius puts you in a good spot


Hey again man, thanks a lot for the reply. That actually gave me some smart ideas since I actually don’t need to execute the combat logic from the success of the move to node. I already do some regular checks for new targets and stuff like that so it actually makes a bunch more sense to only move if we are too far away to shoot in the first place. Should be more efficient since I don’t do a bunch of unnecessary move to nodes. So even if the original problem might not be solved its probably not a good way to use the node anyway.

Thanks again :smiley:

1 Like