#Skeletal Controller Single Bone + Custom C++ Anim Instance
In your Anim BP
Make a Skeletal Controller for Single Bone
Extend your Anim BP class, making your own AnimInstance class that has your custom FTransform or FVector or FRotator Vars in it
Then set these vars any time from anywhere c++ after accessing your custom anim instance.
You can even implement custom logic in the tick of the animation instance itself!
#My Wiki Tutorials
Custom Anim BP Vars in C++
Custom Logic in Anim BP Tick in C++
#Advantages
You can modify animations that are playing if the Skeletal Controller is applied after the animation blends / montages / Slots
It’s easy to use
Can do it with multiple bones and handle each case separately without one interfering with the other, enabling/disabling each modification as per your C++ logic / gameplay flow
Was this ever solved? It looks like the bone data is private except for the names:
FReferenceSkeleton* RefSkeleton = &Mesh1P->SkeletalMesh->RefSkeleton;
for (int32 i = 0; i < DebugRequiredBones; i++)
DebugBoneNames.Add(RefSkeleton->GetBoneName(i));
I would like to get the positions and change them if possible arg…
There is a UPoseableMeshComponent class that allow you to manually move any bone in the C++ code.
You can use it instead of USkeletalMeshComponent and set any transformation to the LocalAtoms[].
Worked perfectly for me, though I don’t know is it possible to add an animation blueprint to it (if you need one).
There is a UPoseableMeshComponent
class that allow you to manually move
any bone in the C++ code. You can use
it instead of USkeletalMeshComponent
and set any transformation to the
LocalAtoms.
Could you explain how you converted class USkeletalMeshComponent to class UPoseableMeshComponent ?
I am almost in the same situation as Numat, the only difference is that I work with the ACharacter class.
You can’t convert it. You need to create the UPoseableMeshComponent instead of USkeletalMeshComponent, and then you can set the same mesh to poseable component
If someone has a better solution that does not hesitate
AMyCharacter::AMyCharacter(const FObjectInitializer& ObjectInitializer)
{
static ConstructorHelpers::FObjectFinder<USkeletalMesh> skeletalMesh1(TEXT("SkeletalMesh'/Game/ThirdPerson/Character/ThirdPersonSkeletalMesh.ThirdPersonSkeletalMesh'"));
GetMesh()->SetSkeletalMesh(NULL);
MeshComponent = ObjectInitializer.CreateDefaultSubobject<UPoseableMeshComponent>(this, TEXT("MeshComponent"));
MeshComponent->SetSkeletalMesh(skeletalMesh1.Object);
MeshComponent->SetMobility(EComponentMobility::Movable);
RootComponent = MeshComponent;
GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f);
UCapsuleComponent* capsule = this->GetCapsuleComponent();
capsule->AttachTo(RootComponent);
// Create a camera boom (pulls in towards the player if there is a collision)
CameraBoom = CreateDefaultSubobject<USpringArmComponent>(TEXT("CameraBoom"));
CameraBoom->AttachTo(RootComponent);
CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character
CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller
// Create a follow camera
FollowCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("FollowCamera"));
FollowCamera->AttachTo(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation
FollowCamera->bUsePawnControlRotation = false; // Camera does not rotate relative to arm
}
If you need to use it in the ACharacter class I think you need to use that UPoseableMeshComponent instead of the character Mesh, not creating it beside the skeletal one. Try to not use and initialise the ACharacter::Mesh at all.