so I’m trying to make a game with RTS style selection and movement. I have the selection part done, but whenever I issue a move command, it simply either teleports the units or moves them at break-neck speeds to their destination. I’m trying to use a floating pawn movement component for now. Changing the speed, acceleration, or deceleration changes nothing about my pawns’ movements.
void AKCameraPawn::MoveToLocation(const FVector location)
{
UNavigationSystem* const NavSys = GetWorld()->GetNavigationSystem();
for (AKBasePawn* unit : SelectedUnits)
{
float const Distance = FVector::Dist(location, unit->GetActorLocation());
if (NavSys && (Distance > 120.0f))
{
NavSys->SimpleMoveToLocation(unit->GetController(), location);
}
}
}
I followed the code and I found this in UNavigationSystem::SimpleMoveToLocation
UPathFollowingComponent* PFollowComp = nullptr;
Controller->InitNavigationControl(PFollowComp);
I’ve looked at InitNavigationControl and it simply assigns the pointer to the controller’s UPathFollowingComponent:
void AAIController::InitNavigationControl(UPathFollowingComponent*& PathFollowingComp)
{
PathFollowingComp = PathFollowingComponent;
}
There doesn’t seem to be any way to assign this field, and it seems clear to me that the navsystem/aicontroller are not using the movement component I’ve added to my pawn blueprint. If anyone knows what I’m doing wrong or can explain how these class interactions work, it would be highly appreciated.