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. 

ACharacter and APlayerController Tick Interfering

I've been messing around with my custom ACharacter & APlayerController code. I'm confused about the differences of these base classes, I see the ACharacter is associated with an actual pawn object, and I suppose APlayerController can be associated with the movement functionality. However, ACharacter can also be associated with the movement functionality if we wanted that there instead. Is it setup like this just for flexibility, or are there situations where I should make sure I'm keeping these separate correctly?

My main problem is, within my ACharacter I have a Tick function that is executing some movement behavior. However, I started messing around with the APlayerController and I added it's own TickActor functionality there and now it seems that TickActor functionality is overriding my ACharacter functionality. Should I be making sure to just keep this sort of functionality contained to one of these classes or the other?

It seems like functionality is being disabled in my ACharacter. I just noticed that my AMyCharacter::SetupPlayerInputComponent isn't being called anymore either.

Thank you for any insight.

Product Version: UE 4.7
Tags:
more ▼

asked Apr 26 '16 at 01:11 AM in C++ Programming

avatar image

Oam
1 2

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

1 answer: sort voted first

APlayerController is associated with players and it is how you get inputs to your character from your keypresses. It remains when your character dies - it only resets when you change levels. ACharacter is, as you said, the physical representation of the character. Movement functionality is best to keep in UCharacterMovementComponent which is loaded as a character component. That will allow you to have custom movement types for different types of pawns and allows you to invoke either the same movement for all your pawns or then have a separate movement for for example vehicles. Having movement logic in ACharacter is also possible. Depending on the type of game you are running, APlayerController is usually the best place to keep the aiming logic and to control what is on your screen, ie. the viewport, because APlayerController is where you inputs are received.

There are some differences in how Characters, MovementComponents and PlayerControllers are replicated, so if you are making a multiplayer game, you should really look into that before going forward.

SetupPlayerInputComponent is called from PlayerController whenever a pawn/character is possessed, if my memory serves me correctly. You might have changed something in that regard. Or maybe you forgot to override it in AMyCharacter? Difficult to say without access to code.

more ▼

answered Apr 26 '16 at 10:31 AM

avatar image

Groatse
232 16 8 25

(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