Proper way of handling controls

Hello, I’m starting with UE4 and I am pretty much stuck on the link between PlayerController, Character/Pawn and Action/Axis mappings. I would like to know if I’m not understanding something properly or maybe I’m totally of base about what I’m trying to do. I would also appreciate the answers on particular use-cases for which I cannot decipher the proper input handling structure. :slight_smile:

I’ve read/viewed everything I managed to google on this matter and have a following mental picture: In the editor I can setup Action and/or Axis mappings of my events to desired inputs (for example: event MoveForward bind to W key). Next there is a PlayerController that represents player’s will which can Possess Pawn/Character and take control over it. PlayerController in turn issues commands to this Pawn/Character which ultimately performs the desired action. Now for the things I’m not sure about:

1.) Where is better to handle InputComponent bindings and where the actual movement logic (in the Controller or on the Character or maybe somewhere completely different)?

2.) What would be the correct way to handle the case, when I had an infantry man that could jump into a tank or airplane? Have separate PlayerController for each of these cases + another for some menu navigation and swap between them or have one master PlayerController where all the InputComponent bindings would lie and the swapping would be done only on the level of Possessing different Pawns as would the situation require? If the 2nd case is correct, what would be the behavior in the situation, when the same key would be used to drive different events for different vehicles (for example: while driving a tank W would be used for moving forward, but in the airplane it would be used to pitch up)? Would I get a trigger for both of these events but only that which is doable would be run or only the one that is used to fire some action by currently Possessed Pawn?

3.) Lastly the most important thing that I’ve omitted so far is, that I actually don’t care about traditional movement of character in the world it inhabits. My current goal is to use mouse and keyboard input to select joints from the Character’s skeletal mesh and drive SkelControls to manipulate its hands in-game (I understand there would be aditional steps required to accomplish this, but right now I’m stuck at the input setup). Ultimately I want to interface Kinect with UE4 and copy movement of player’s hands onto an in-game avatar (I assume that at minimum I would need to create brand new PlayerInput class that would somehow handle this type of input, likely a lot more than that). Is this even the correct way to approach this problem or am I totally of base trying to do it this way? (I really hope not)

Thanks!

  1. Unfortunately, this is one of those areas where UE4 isn’t 100% concrete. Sometimes it is better to handle input on the Controller and sometimes it is better to handle it on the Character. It is up to your personal convictions.

  2. If you plan on doing that, just handle the input directly in each character. Doing it this way, you don’t even need a custom player controller.

  3. I’m not sure what you mean, if you’re talking about actually powering the character by their physics…I’m going to go ahead and recommend giving up right now. There is a very major reason that games don’t use this already. However, if you’re just talking about making the limbs move according to the objects around them then you can look into Inverse Kinematics.

Hi, thanks for your reply. :slight_smile:

Yeah, that’s what I figured… I hoped there would be some best practice guideline which could deal with any type of input cases (multiple characters controlled at once, swapping various types of actors, etc.) and then there would be some quick and dirty methods that could deal with simpler cases like controlling one and only actor that can only jump, move and shoot or something like that :slight_smile:

To clarify what I meant in the 3rd case, I’m attempting to do something like this. However, this is the ultimate goal. Right now, I’m just trying to move limbs of a skeletal mesh character with keyboard and mouse and I wasn’t sure where would be best to set it up (on PlayerController, directly on Character, somewhere else?). I’m sorry if I get a little bit off topic since this is C++ Gameplay Programming section of the forum and not Animation, but my idea is to choose a specific joint of a skeletal mesh and then use a mouse to rotate the whole part of limb that is attached to that joint (for example u take an elbow and will rotate the whole hand and forearm - the angle between upper arm and forearm will be changing but all other will stay the same, for example between forearm and wrist).

For a change, I didn’t actually understand what you meant by “powering the character by their physics”. Could you clarify please?

The way you worded it sounded like you wanted to move the characters based on real life physical constraints. In other words, skeletal structure, muscles power, etc. How people move in real life.

As for what you posted, it looks a lot like IK.
However, if you’re going to be controlling what joints move with the mouse and don’t wish to worry about collision, then you can just move them in code by editing the bones rotation and what not.