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"

C++ based character wont move

I was following FPS tutorial from UE wiki page (https://docs.unrealengine.com/latest/INT/Programming/Tutorials/FirstPersonShooter/index.html) but for some reason my character refuses to move.

I have made everything according to the tutorial and even redone entire thing altogether just to be sure. I have checked i have right character spawned and actions in project setting have correct name (the screens). I have placed debug line in movement functions to be sure they're being fired when the right key is pressed and value is correctly set to 1.0 when that happens.

At this point I'm all out of ideas why character wont move. I'm pretty sure its just some basic setting but cant figure what.

My code in character class

 // Called to bind functionality to input
 void AMainCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
 {
     Super::SetupPlayerInputComponent(PlayerInputComponent);
 
     PlayerInputComponent->BindAxis("Forward", this, &AMainCharacter::Forward);
     PlayerInputComponent->BindAxis("Right", this, &AMainCharacter::Right);
 }
 
 void AMainCharacter::Forward(float value)
 {
     FVector dir = FRotationMatrix(Controller->GetControlRotation()).GetScaledAxis(EAxis::X);
     AddMovementInput(dir, value);
 }
 void AMainCharacter::Right(float value)
 {
     FVector dir = FRotationMatrix(Controller->GetControlRotation()).GetScaledAxis(EAxis::Y);
     AddMovementInput(dir, value);
 }

alt text alt text alt text

Product Version: UE 4.16
Tags:
preview.jpg (53.2 kB)
modes.jpg (13.4 kB)
modes.jpg (13.4 kB)
input.jpg (20.4 kB)
more ▼

asked Jul 31 '17 at 10:20 PM in C++ Programming

avatar image

DFDark
8 3 6 8

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

1 answer: sort voted first

Like I have written answer was really really beginner's mistake. I was so focused on editor settings and character code that I neglected to check GameModeBase class.

Error was missing line in constructor of GameModeBase class:

     Super::StartPlay();

I would still like to know why it caused that though.

more ▼

answered Aug 01 '17 at 06:12 PM

avatar image

DFDark
8 3 6 8

avatar image gedamial Jul 20 '18 at 03:56 PM

Had the same problem, thanks for posting the solution!

(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