如题,AIController调用MoveToActor,在Pawn中覆写RequestDirectMove来控制移动,本来好好地,突然就没用反应了,求教。AIController里面:
void AAITankController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
auto PlayerTank = GetWorld()->GetFirstPlayerController()->GetPawn();
auto ControlledPawn = GetPawn();
if (!PlayerTank || !ControlledPawn) { return; }
//向玩家移动
MoveToActor(PlayerTank,AcceptRadiu); //在这里调用MoveToActor
}
//Pawn的MovementComponent里面
void UTankMovementComponent::RequestDirectMove(const FVector& MoveVelocity, bool bForceMaxSpeed)
{
UE_LOG(LogTemp, Warning, TEXT("Moveing to actor"));
}
|