x

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. 

GetCharacterMovement

Hi Eceryone! I'm trying to follow this tutorial, about an fps controller: https://wiki.unrealengine.com/First_Person_Shooter_C%2B%2B_Tutorial

And when coding the movements

     if ((Controller != NULL) && (value != 0.0f))
     {
         // find out which way is forward
         FRotator Rotation = Controller->GetControlRotation();
         // Limit pitch when walking or falling
         if (CharacterMovement->IsMovingOnGround() || CharacterMovement->IsFalling())
         {
             Rotation.Pitch = 0.0f;
         }
         // add movement in that direction
         const FVector Direction = FRotationMatrix(Rotation).GetScaledAxis(EAxis::X);
         AddMovementInput(Direction, value);
     }

I'm having troubles with CharacterMovement (I have my own class AFPSCharacter : public ACharacter ) Who inherits from ACharacter, but the CharacterMovements seem to be Private, and if i use the getter GetCharacterMovementComponent, it returns a PawnCharacterMovement.

How could i fix this code? Any hints would be really appreciated! Thanks in advance!

Product Version: UE 4.18
Tags:
more ▼

asked Mar 07 '19 at 04:44 PM in C++ Programming

avatar image

CalaveraX
8 1 2

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

1 answer: sort voted first

Hi CalaveraX,

The proper getter to get the Character Movement component of a Character is GetCharacterMovement(), not GetCharacterMovementComponent().

Hope it helps.

more ▼

answered Mar 07 '19 at 05:59 PM

avatar image

Elou44
179 3 9 7

avatar image CalaveraX Mar 07 '19 at 06:04 PM

That gives me an error (My visual studio is in spanish, so i'm not sure about how to correctly translate it)

Error (activo) E0393 no se permite un puntero a un tipo de clase incompleta

avatar image CalaveraX Mar 07 '19 at 06:06 PM

Ohhh, i'm feeling like an idiot now... i just had to include #include "GameFramework/CharacterMovementComponent.h" Thanks!

(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