Announcement

Collapse
No announcement yet.

Set Animation Blueprint to Character from C++

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Set Animation Blueprint to Character from C++

    I am trying to set an animation blueprint class to a character from C++. How can I do it and what is the best way to do it?
    Thank in advance

    #2
    you can set new AnimBp of a skeletal mesh component, not the character, so add this code to your skeletal mesh component class, or add GetMesh()-> before the function calls:

    // as I remember this is needed to get it work
    SetAnimationMode(EAnimationMode::AnimationBlueprint);

    // I store the AnimBp classes is an array of UAnimInstance-s for each weapon, so select the new class to use
    TSubclassOf<UAnimInstance> AnimBp = AnimationBlueprintClasses[WeaponUsed];

    // switch to the new AnimBp
    if (AnimBp)
    {
    SetAnimInstanceClass(AnimBp);
    }
    Last edited by sivan; 02-15-2020, 07:33 PM.
    Edge of Chaos RTS
    "Age of Total Heroes" - RTS Pathfinding and Movement System for UE4
    RTS Camera C++ Tutorial

    Comment

    Working...
    X