No announcement yet.

When rotating a Character, where should I perform that rotation - Controller or Character?

  • Filter
  • Time
  • Show
Clear All
new posts

    When rotating a Character, where should I perform that rotation - Controller or Character?

    Hi folks,

    I've got custom Player Controller and Character classes. I'm trying to learn UE4 structure (my very first project) by making a "true first person" camera / character. I've watched some videos and read some blog posts and now I'm trying to build it myself using my own understanding of things.

    My camera is a sub object of my Character's Mesh - attached to its head. So, my camera currently just moves along with whatever the Character is doing.

    I'm starting to build in input handling and Character movement, but I'm unsure of the topology of the Player Controller and Character within the world. Allow me to explain a few things that I understand to be true and then I'll finish with what I'm confused about how to properly do ...

    1. I understand that the Player Controller is an AActor, which means it physically exists in the game world and therefor has a rotation. So, you can actually rotate the Player Controller within the world.

    2. A Character also has its own rotation within the world, but it can be set to use the rotation of the Player Controller optionally - the default being to use the rotation of the Controller.

    So what I'm unsure about is which item to rotate when I want to rotate my Character. Should I be rotating my Controller, and have my Character use the same rotation? Should I make my Character ignore Controller rotation, and instead rotate the Character individually - this seems most logical to me?

    Is the Character actually a sub component of the Controller? So, invisibly in the world the Controller is like a capsule around the Character or something?


    You are correct that the Player controllers is an AActor but many things are. to be more specific it is AController. From the Documentation:

    Controllers are non-physical actors that can possess a Pawn to control its actions. PlayerControllers are used by human players to control pawns, while AIControllers implement the artificial intelligence for the pawns they control. Controllers take control of a pawn using their Possess() method, and relinquish control of the pawn by calling UnPossess()

    The Character on the other hand is a sub class of APawn which the documentation defines as:

    Pawn is the base class of all actors that can be possessed by players or AI. They are the physical representations of players and creatures in a level.

    So your controller is what you are using to possess your pawn. How you choose to manage how input is resolved between these two classes is what ever is best suited to the needs of your game. the importance of separating the two really relates more to the times in which your are possessing/unpossessing different pawns. (example being your character dies and a new one is spawned). It is possible to have a playable character with no Player controller if your game does not require one.

    First time responding so i hope this was helpful.


      You should let the Character Movement Component do all the movement and rotation. Player input should be directed to the movement component. If you create a new 1P/3P project this should already be setup correctly.