x

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"

How to assign a Player Controller to Client? C++

Maybe this is a silly question, but I can't find a single line of documentation or help on this subject. The tutorial I followed used a third-person setup, so it automatically spawned a second player for them on the Client, which worked fine for the tutorial, but they never explained how to assign a custom character to the client. I have a custom pawn which assigns it's control over Player0, like so:

AutoPossessPlayer = EAutoReceiveInput::Player0;

As long as the pawn is in the scene, this works perfectly on the server side, but no matter what I try, the client just creates some kind of empty actor that is basically a duplicate of the editor controller (Right click to look around, WASD to move, etc..). How do I make my client possess a second pawn, just like the one on the server side?

Product Version: UE 4.8
Tags:
more ▼

asked Aug 14 '15 at 08:39 PM in C++ Programming

avatar image

Jasper_Moore
8 1 4 6

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

You can have a controller posses any pawn by calling the Possess(NewPawn) function. It will automatically UnPossess the previous pawn if one was set.

more ▼

answered Aug 14 '15 at 09:18 PM

avatar image

joeGraf STAFF
1.5k 35 12 68

avatar image Jasper_Moore Aug 17 '15 at 02:28 PM

Thanks for your answer. I'm still not sure how to access my pawn as the variable in that function, though. My class is the pawn, so do I need another class to spawn them into the world and assign them? In the tutorial I followed, we never explicitly assigned a controller/pawn/character, we just added an example function at the bottom of the existing third-person character class, but if I make the "number of players" 2 or 3, etc.. It automatically spawns more of that class for each window. How does this happen without directly assigning them?

(comments are locked)
10|2000 characters needed characters left
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