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