Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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:


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


  // 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
 // 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)
   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));
       // ProxyAI copies the character to ensure he is around when we click to move
       Transform.LerpTranslationScale3D(CharTransform, MyTransform, ScalarRegister(0.5f));

Thanks in advance,

Product Version: UE 4.7
more ▼

asked Jun 06 '15 at 01:40 AM in C++ Programming

avatar image

129 10 11 15

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jun 06 '15 at 10:08 AM

avatar image

2.2k 83 37 121

avatar image Venros Jun 06 '15 at 08:34 PM

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,

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question