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 set up inputs for player controller and pawn?

I'm struggling to get my head around what logic should be in a player controller and what logic should be in a pawn. Looking at the UE4 manual it says "the PlayerController decides what to do and then issues commands to the Pawn" giving examples of jump and start crouching.

Say I want a pawn to jump... would I have the key press be in the PlayerController which then immediately runs a custom event or a function that holds the logic for the jumping in the pawn? How do I get the players will to issue commands to the pawn? What would the command be in this case? I just think seeing something really simple would help wrap my head around the concept of player will and commands.

Product Version: UE 4.21
more ▼

asked Jan 31 '19 at 11:35 AM in Blueprint Scripting

avatar image

8 2 3 5

avatar image Nebula Games Inc Jan 31 '19 at 01:33 PM

Technically the "controller" should contain everything common to ALL possible controlled pawns. So if every pawn you have can walk, run, jump then have those events in your player controller. If only 1 pawn can fly, then you should have flying behavior either in a separate controller for flying pawns that you will switch to when in a level where you fly OR put that within the flying pawn BP and the player controller will maybe have a small sub-section of commands it can issue to a flying character. So the controller will handle the "input" from the player. So when the "Space Bar" is pressed do "X". If all pawns do the same thing when you press "space bar" like "jump" then script that in the controller. If each pawn does something different when you press the space bar like a unique "Attack" then script that specific logic within the pawn and have the controller call an interface event in the controlled pawn and that way each pawn can have their own attack, but ALL pawns will attack when space bar is pressed. This way the controller only contains code common to ALL pawns while each pawn individually would contain code unique to itself.

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

0 answers: sort voted first
Be the first one to answer this question
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