My enemy going in a direction, instad of going to a location

im making enemy that its just a floating cube. but when i trying to make it chase a target - it just going in a streight line.
i thoght that the enemy coliding with the mesh (of the box) but the same problem happening when i removing collision, or removing the mesh (the mesh still ther - but its empty)

EnemyController = Cast(GetController());
if (EnemyController && Target)
{
FAIMoveRequest MoveRequest;
MoveRequest.SetGoalActor(Target);
MoveRequest.SetAcceptanceRadius(10.f);
FNavPathSharedPtr NavPath;
EnemyController->MoveTo(MoveRequest,&NavPath);
}

thats the code

Not totally sure what you are asking, but if the AI is running straight towards the target without avoiding objects, those objects are most likely not influencing the navmesh and so when creating the NavPath, the engine doesn’t know to go around those things.

If you select your NavMeshBoundsVolume and press P, does the nav mesh draw around your terrain appropriately like shown below?

no,but thanks. the problem wah that the enemy was going in a direction, but he continud to go in that direction even when he reached the destenetion

the problem whas that i set the capsule radius to 0, seting it to 0.1 fixed the isue

1 Like