1

I am using Unreal engine 5 i want to rotate the bones of the Default mesh but its says Unreal Engine 5class USkeletalMeshComponent has no member TransformBone and SetBoneRotationByName

I am using Unreal engine 5 i want to rotate the bones of the Default mesh but its says Unreal Engine 5class USkeletalMeshComponent has no member TransformBone and SetBoneRotationByName

// Generate random rotation values for the hand bone
FName HandBoneName = TEXT("Hand_Bone"); // Replace with the actual bone name
FRotator HandRotation = FRotator(FMath::FRandRange(-45.0f, 45.0f), FMath::FRandRange(-45.0f, 45.0f), FMath::FRandRange(-45.0f, 45.0f));

// Apply the random rotation to the hand bone
USkeletalMeshComponent* CharacterMesh = GetMesh(); // Assuming your character's mesh is named "Mesh"
CharacterMesh->SetBoneRotationByName(HandBoneName, HandRotation, EBoneSpaces::ComponentSpace);


and

FName HandBoneName = TEXT("Hand_Bone"); // Replace with the actual bone name
            FRotator HandRotation = FRotator(FMath::FRandRange(-45.0f, 45.0f), FMath::FRandRange(-45.0f, 45.0f), FMath::FRandRange(-45.0f, 45.0f));
        // Apply the random rotation to the hand bone
USkeletalMeshComponent* CharacterMesh = GetMesh(); // Assuming your character's mesh is named "Mesh"
CharacterMesh->TransformBone(HandBoneName, FTransform(HandRotation), EBoneSpaces::ComponentSpace);

but both of them are not working

  • 1
    Can you link what documentation you used that states that it should have those members? Because they don't appear in their online docs: https://docs.unrealengine.com/5.2/en-US/API/Runtime/Engine/Components/USkeletalMeshComponent/ – UnholySheep Jul 14 '23 at 21:06
  • yeah sorry for that i was using chat gpt but i am stuck and new to it so dont really know much about UnrealEngine 5 Can you please guide me if i have 3d (x,y,z) how can i move a bone just using c++ – Muhammad Tariq Jul 14 '23 at 21:13

0 Answers0