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"

Do the same in c++ from blueprint

alt text

Hello. I cant find a way to do the exact same thing in c++. Basically im making a 2d game and im not using the 2d slider template cause i wanna learn it in c++. So i want my character to rotate itself in the direction im moving stay in that direction util any other input. Hope it makes sense.

Product Version: UE 4.22
capture123.png (247.0 kB)
more ▼

asked Aug 09 '19 at 09:04 PM in C++ Programming

avatar image

3 1 2

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

1 answer: sort voted first

Returns controller for this actor.



Implements a container for rotation information. All rotation values are stored in degrees.

 const FRotator MyRotator = FRotator(0.f, 0.f, 0.f);



Set the control rotation. The RootComponent's rotation will also be updated to match it if RootComponent->bAbsoluteRotation is true.



more ▼

answered Aug 10 '19 at 07:40 PM

avatar image

173 5 8 9

avatar image GameGod786 Aug 10 '19 at 10:14 PM

Hello. Thank you for replying. This is the problem im having now. If i press D(right) it moves right and faces right fine but if i press A(Left), it moves right again but faces left and as soon as i left the key A it faces right again. So character always moves in right direction. Also my root which is a capsule is inherited so i dont know how to access its babsouluterotation bool. This is the code for move right.

 void AMyCharacter::MoveRight(float value)
     AController* Controller = GetWorld()->GetFirstPlayerController()->GetPawn()->GetController();
     FRotator Rotate;
     if (value < 0)
         Rotate.Add(0, 180, 0);
         Rotate.Add(0, 0, 0);
     AddMovementInput(GetActorForwardVector(), value);
avatar image danielf94 Aug 12 '19 at 01:42 PM

Verify the value you are placing on your buttons in the "input". Enter project settings-> input


check the "Third Person" project of c ++. There is all that explained.

(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