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"

Set DefaultPawn as DefaultPawnClass

Hi everyone,

So I'm looking for a simple RTS camera. Basically, DefaultPawn already comes with all the key ingredients for being such camera, as inputs and movement are already set in its CPP file.

Only question remains is: why can't I make it a DefaultPawnClass in the GameMode?

Here is the GameMode.cpp:

 AVikingKingGameMode::AVikingKingGameMode(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
 {
     // set default pawn class to our Blueprinted character
     static ConstructorHelpers::FClassFinder<APawn> PlayerPawnBPClass(TEXT("Pawn'/Game/TopDown/GameCamera/GameCamera.GameCamera_C'"));
     if (PlayerPawnBPClass.Class != NULL)
     {
         DefaultPawnClass = PlayerPawnBPClass.Class;
     }
 }

Both my camera class cpp and h files are empty.

Image for the Blueprint I made of the camera class location is attached.

Location

Thanks.

Product Version: Not Selected
Tags:
more ▼

asked Apr 07 '15 at 10:20 PM in C++ Programming

avatar image

kostor
72 12 17 18

avatar image Spiris Apr 07 '15 at 10:42 PM

It is probably a good practice to keep blueprints as children of code classes, and set the default pawn of a blueprinted game mode as your blueprinted pawn class. You can have each of these be a child of a class you made in cpp so you have the functionality of both worlds at your fingertips. I don't think you want to have a blueprinted class as the default pawn class of your cpp gamemode class.

avatar image kostor Apr 07 '15 at 10:47 PM

@Spiris I understand. It also seems to work when I deactivate the usage of the DefaultPawn inputs, and use my own ones.

How do you suggest using the Bluprinted camera class as default pawn in the GameMode, while the template itself produces a code version of the GameMode (thus not allowing me to use a blueprint)? Should I make a blueprint of the C++ GameMode that is created with the template?

avatar image Spiris Apr 07 '15 at 10:52 PM

You got it Kostor, that should allow you to set up the default pawn in blueprints and give you access to a whole lot of other easy modifications.

avatar image kostor Apr 07 '15 at 10:54 PM

Thank you so much for your help, I'm marking this entry as answered for now.

avatar image Spiris Apr 07 '15 at 10:56 PM

Glad I could help, feel free to ask any followup questions as necessary.

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

1 answer: sort voted first

Please advise the comments above this answer.

IMPORTANT: When using the DefaultPawn, you should blueprint it, and the GameMode. This way, you can set you blueprint of the DefaultPawn as DefaultPawnClass in the GameMode.

more ▼

answered Apr 07 '15 at 10:55 PM

avatar image

kostor
72 12 17 18

(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