Download

Doing some tasks using code instead blueprints

Hi, I’m not very good using blueprint, as it was not good using kismet. I prefer the coding.

I am following this tutorial: https://wiki.unrealengine.com/First_Person_Shooter_(Tutorial)

and I find the final part, which talks about the animations, too complex, with many steps to get what was achieved in UDK with only 4 nodes.
Probably the new system is very powerful and has many uses, but to make a simple AnimTree I see it too much complex.

I wish I could control the animations from code, choosing which animation to blend according to the pawn physics, acceleration, etc… with none or minimal intervention of blueprints. Can this be done?

I would also like to know if it’s possible to define pawn properties from code, as was done in UDK in defaultProperties, instead of creating a blueprint.

You can just read the code lying under the blueprints whichfunctionality you want. For the properties, i actually advice you to use blueprints jsut as the defaultproperties part, this way you can make many different variations of your class, and also test better. However, otherwise, jsut use the constructor or the BeginPlay function.

I imagine that it is possible to do it, but learning Anim Blueprint is definitely the better way forward.

You can certainly define defaults in C++, you just do it in the Constructor rather than the defaultproperties block. Take a look at the C++ templates for some examples.

We don’t really have a workflow for setting up animation blends in C++ though I’m afraid. Normally this gets complicated quite quickly so we rely on tools to set it up. Having said that, it should be possible to create your own AnimInstance derived class and do everything yourself, we have just never tried it.

Good, it’s easy to initialize property in the blueprints, if you can re-edit from the code after. Thanks.

In the Unreal editor (you compiled preferably in Debug) go to File -> Add Code to Project and select **Pawn **as base class. You can override and add new functions, the whole nine yards.