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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

character pitch - "default behavior"

I've got a quick question here:

How does UE4 handle (input-based) character rotation by default - or: what is the common approach to deal with character rotation?

I guess yaw is pretty straight forward. It's probably just the root component being rotated. But what about pitch? If I call "AddControllerPitchInput(Val);" on a character, something happens that rotates the camera attached to it, but obviously the character mesh itself is not rotating.

So I'm wondering what values are responsible here and where they are stored. Is there some kind of pitch-variable on a character that somehow only affects looking/aiming etc?

Product Version: UE 4.10
more ▼

asked Nov 24 '15 at 12:34 PM in Using UE4

avatar image

643 65 82 116

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

1 answer: sort voted first

The "AddControllerPitchInput"-Function ultimately sets an FRotator-Variable inside the Character's PlayerController called "RotationInput.Pitch"

You could set the Characters "UseControllerRotationPitch"-Variable to true to make the character rotate instead of the camera and set the "InheritPitch"-Variable of the Camera Boom to true to make the camera follow the characters pitch ... if that is what you are aiming for?

more ▼

answered Nov 24 '15 at 06:16 PM

avatar image

426 38 47 143

avatar image MaxPower42 Nov 24 '15 at 09:21 PM

Thanks for answering.

I guess what I am aiming for is to understand what's going on in the background and find the "cleanest" way to deal with input, without using any redundant variables, and then write an "open" and flexible approach to allow controlling all different kinds of pawns and characters with a single controller class (probably via input-interface-functions).

Does the RotationInput accumulate input or does it get reset every tick or call? I mean, is it an actual rotation or just a "delta-rotation"? I just want to understand this, so I can code a good system right from the start.

avatar image Pseudocorpus Nov 25 '15 at 05:46 PM

This is what I got from the source code:


 void APawn::AddControllerPitchInput(float Val)
     if (Val != 0.f && Controller && Controller->IsLocalPlayerController())
         APlayerController* const PC = CastChecked<APlayerController>(Controller);


 void APlayerController::AddPitchInput(float Val)
     RotationInput.Pitch += !IsLookInputIgnored() ? Val * InputPitchScale : 0.f;

So it seems it is some kind of "delta-rotation", rather than an "absolute rotation".

avatar image MaxPower42 Nov 26 '15 at 06:20 AM

Thanks again for looking that up. I didn't even think of the fact that the entire source code is available. I'm still very new to UE.

Interesting, so Pawn::AddControllerPitchInput(Val) doesn't actually do anything with the pawn itself, only the controller. Why do you think RotationInput is a delta? I can be wrong, but doesn't it look like on every update (AddPitchInput) it accumulates "Val * InputPitchScale" (<- delta?) on top of the existing rotation, making it absolute?

avatar image Pseudocorpus Nov 27 '15 at 05:28 PM

Oh yeah, sorry. That is what I meant. It accumulates to the RotationInput-Value. :)

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