Hi,
I’m a bit confused about how to setup a custom playable character (skeletal mesh with custom animations).
From what I read, blueprints are the way to go, but I’m having hard time to figure out what to do/how to create the blueprint I need to change the default character cube (my project is based on the third person project). I’m also confused because this type of configuration in UE3 was done withing the defaultproperties slot (which doesn’t exist anymore in C++, right ?). I tried to read and understand the C++ classes that my project inherit but I’m lost (my C++ knowledge is a bit rusty).
I wouldn’t mind a little enlightenment on how to process (in the big step, no need to be super precise). Especially regarding what is the logic now in the engine regarding the previous system in UE3.
Hi Fabrice,
The defaultproperties block doesn’t exist anymore, but everything that you would have done with it now lives in the C++ constructor for your class (e.g., AMyPawn::AMyPawn(const FPostConstructInitializeProperties& PCIP)
).
In order to do a custom character animation, you would first create a Vim Blueprint in the editor, which is similar in concept to the AnimTree asset in UE3, but much more powerful as it can also contain arbitrary blueprint logic.
Once that is done, on your skeletal mesh component, fill out the AnimationBlueprint property to reference your vim asset.
There are two different schools of thought about content references in C++. You can either directly reference the vim in C++, doing something like the following in your constructor:
static ConstructorHelpers::FObjectFinder MyVim(TEXT("VimBlueprint'/Game/MyCharacterVim.MyCharacterVim'"));
MySkeletalMesh->AnimationBlueprint = MyVim.Object;
Or alternatively, leave it unassigned and treat the C++ class as a base class, creating a derived blueprint of your character/pawn, and filling out the AnimationBlueprint reference in the editor. This approach is a tiny bit more work initially, but is data driven and leaves the C++ code with a looser binding to content.
Cheers,
Michael Noland
We will soon be updating the Third Person template to use an animated skeletal mesh instead of a box, to give you a better starting point.
Thanks a lot, I was able to setup a custom blueprint with my skeletal mesh !
There are several ways of doing so:
The simplest one is to edit MyCharacter blueprint which you will find inside Game folder. Just go to Components section of Blueprint and change your skeletal mesh.
The Second way is to edit your C++ code:
It’s also simple but can be bit daunting if ypu never programmned in more general purpose language.
First find your GameInfo implementation file (cpp).
Here will be:
AYourGameInfoClass::AYourGameInfoClass(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
This is your constructor. Simply speaking without going much into detail class constructor is special method that have exactly the same name as class which it construct. Here you can initialize all your properties and do other things that must be done before class is used.
In any case you will find a line here:
static ConstructorHelpers::FObjectFinder PlayerPawnOb(TEXT("Blueprint'/Game/Cloth/Cloth_character.Cloth_character'"));
The part after the TEXT is path to your pawn blueprint. Can change it any other pawn blueprint you created (remember it should derive from Pawn Class or Character or anything that is in this hierarchy).
If I understrand it correctly ConstructorHelpers can be used to find any type of Object within unreal and then do something with it. (in this case we setup default Pawn Class in if clousure_.
Anyway I recomend reading some C++ books or tutorials. C++ is no that hard as it first appears