So I’ve read not to put the actual controls in the characters or pawn. So I have to ask what’s the best way to set it up? Should I have a “control interface” call the key bindings from the controller to the character and then move through the logic? I just need to know, where’s the best place to implement the actual logic and where’s the best place to tie the logic to input for best re usability? A little pointers please.
It’s OK to setup movement on your character based on input but to setup keys is in the editor preferences under input.
Assuming you’re not using any C++ at all in your project, you may either grab inputs directly and then modify the inputs parameters from the editor (which can be further modified in any options menu), or you may preprocess the inputs using a “control interface” like you mention.
I suggest maintaining a controls interface.
In particular, for my projects I maintain a GameCharacterMaster class with the sectionss “PCInput” and “GamepadInput” that both get preprocessed and piped into “MovementInput”, “ActionInput”, and “JumpInput” (jumping can end up being a bit complicated but usually quite generic).
Other types of characters can then subclass this GameCharacterMaster class.
A working example of almost exactly this model can be found in the Mixamo Animation pack.
It’s a little confusingly named, but it comes with characters set and ready to go.
It depends entirely on your project. For instance, if you’re going to have a single controllable character or a set of characters with the same inputs, you can easily place all your controls in your player controller, then pipe those commands to your possessed character. If you’ve got a set of pawns with unique inputs (maybe one is a character, one is a car, one a plane, etc.) then you can put them in the character/pawn themselves.
As calembendell suggests, if you have a set of pawns which share controls, you could create a base class that implements them. E.g. CharacterControlBase, CarControlBase, etc. Or you can implement them through a custom actor component. E.g. CharacterControlComponent or CarControlComponent which you then add to the appropriate pawns.
Just remember, your project is your project, it is not your friends project or the project of some guy on the internet. What suits their needs may not suit yours. Don’t blindly follow advice without context.
hey ryan, would you be so kind as to mark a best answer to resolve this issue?
thanks!