PlayerCharacter Controlling an AI not working

Hi guys,

So I’m trying to implement my version of networked pathfinding, and the way I’m implementing it is by spawning an invisible pawn that mimics my character movements and rotation, but as soon as I click to move my AICONTROLLER would tell the invisible pawn to pathfind to the location (while having my character mimic its location/rotation).

So I have the following:

PlayerController.cpp

-Clicktomove → LocationToMove : sends the mouse click location to my character (mage)

Mage.cpp

 // While true the player copies the AI's movement, true when we clickToMove in playerController.cpp
 bool bPathFind;
// Spawn the proxy with invisible mesh at the Mage's location
AAPawn* characterProxy;
// Possess the proxy with an AI controller
AAIController* proxyController

proxyController->possess(characterProxy)

// Move the AI to the location
LocationToMove(FVector location) { proxyController-> MoveToLocation(location); }

But of course my AI does not move (the function gets called fine, but he simply will not move to the location)

To clarify things a little better here is my tick function, that decides which pawn mimics what:

// Called every frame
void AMageCharacter::Tick(float DeltaTime)
{
  Super::Tick(DeltaTime);

  if (characterProxy)
  {
    // Keep the Proxy in sync with the real character
    FTransform CharTransform = characterProxy->GetTransform();
    FTransform MyTransform = GetTransform();

    FTransform Transform;
    if (bPathFind)
    {
       //Player mimics the proxyAI
      Transform.LerpTranslationScale3D(MyTransform, CharTransform, ScalarRegister(0.5f));
    }
    else
    {
      // ProxyAI copies the character to ensure he is around when we click to move
      Transform.LerpTranslationScale3D(CharTransform, MyTransform, ScalarRegister(0.5f));
    }
      
    SetActorTransform(Transform);
  }
}

Thanks in advance,

I think the problem is probably that your proxy pawn doesn’t have a movement component. Ideally you should set your proxy up to have the same properties as your real character in order to get the movement you want. So make it an ACharacter, and configure all its movement component properties like agent height and radius, max walkable slope, max step height, etc to be the same as your character’s. In fact you can probably just create a duplicate of the component and assign it.

I’d be interested to know what the accepted method is for implementing this kind of control in UE4, it seems to me like all approaches are a bit awkward.

lol I remember making it ACharacter then changing it back to APawn. Now its finally moving, doing some weird stuff but now I can finally debug the movement.

Its a very hacky system and I really hope they implement networked navigation soon, I did not wan’t to wire 20 different inputs with RoleAuthority to use the version in the link above. I will post once I have mine working; it seems to be the least hacky from what I have seen.

Thanks again,