# How to Set Local Rotation in Anim Blueprint?

**URL:** <https://forums.unrealengine.com/t/how-to-set-local-rotation-in-anim-blueprint/452831>\
**Category:** Blueprint\
**Tags:** unreal-engine, bone-rotation, question\
**Created:** [July 25, 2019, 4:24pm UTC](https://forums.unrealengine.com/t/how-to-set-local-rotation-in-anim-blueprint/452831 "2019-07-25T16:24:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KEATE\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KEATE\_1](https://forums.unrealengine.com/u/KEATE_1)\
**Post date:** [July 25, 2019, 4:24pm UTC](https://forums.unrealengine.com/t/how-to-set-local-rotation-in-anim-blueprint/452831/1 "2019-07-25T16:24:10Z")

</div>

![283285-animblueprint.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/5/2/752fd05541a9371bc701e4ac5f75a981d553381b.png)

It seems should be convert to component space? I just wanna know how to set local rotation.  
I have tried to set it in an ordinary blueprint with poseable mesh component or skeletal mesh component, and I could get bones’ local Transform, but there is no node to set local transform.  
I guess if I set values in from local to component space,it would be the same as “Set Bone Transform By Bone Name(component space)”.  
So, it’s not what I really want.

---

<div class="post-metadata">

**Author:** ![KEATE\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@KEATE\_1](https://forums.unrealengine.com/u/KEATE_1)\
**Post date:** [September 6, 2019, 12:33am UTC](https://forums.unrealengine.com/t/how-to-set-local-rotation-in-anim-blueprint/452831/2 "2019-09-06T00:33:46Z")

</div>

Finally, I used in PoseMesh component in C++, and that works.  
One thing you should pay attention to is we cannot use local space, but unreal offers us an array for accessing bone local transform instead.

---

<div class="post-metadata">

**Author:** ![seungmki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/seungmki/32/88711_2.png) [@seungmki](https://forums.unrealengine.com/u/seungmki)\
**Post date:** [November 23, 2022, 11:09am UTC](https://forums.unrealengine.com/t/how-to-set-local-rotation-in-anim-blueprint/452831/3 "2022-11-23T11:09:05Z")

</div>

Hello, I am looking forward to your answer as it seems to be related to the answer I am looking for.  
I also want to change the local rotation of the bones during runtime. I want my character to do a finger V pose whenever I press a UI button.  
So I’m trying to create a custom animnode in C++ to modify the local rotation of a bone.

We are currently experimenting by writing the logic in the following order.

1. In an animation where the character is doing a V pose, I got the rotation of the finger bones making the pose. I thought I should bring the rotation value of the finger bones into Local Rotation so that the moving character can do the V-pose naturally.

1-1. So I used Anim BP’s Get Socket Transform node to get the local rotation of the RTS\_ParentBoneSpace bone.

 ![20221122_195131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/2/3/b2341a4a9a1c465765a4483a462d2c24fbb69e28.png)

1. Referring to the Transform(Modify) Bone node, I created a custom Anim node that can change the rotation of multiple bones at once.

2-1. RotationSpace is specified as BCS\_ParentBoneSpace since we need to change the local rotation of the bone in the custom anim node.  
 ![20221123_200521](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/e/4/9e4c109df533c9d26646128d19ac43c8e76c84de.png)

```auto
void FAnimNode_ModifyBoneRotationList::EvaluateSkeletalControl_AnyThread(FComponentSpacePoseContext& Output, TArray<FBoneTransform>& OutBoneTransforms)
{
	check(OutBoneTransforms.Num() == 0);

	const FBoneContainer& BoneContainer = Output.Pose.GetPose().GetBoneContainer();
	const FCompactPose& Pose = Output.Pose.GetPose();	

	TArray<FBoneTransform> Temp;
	for (const auto& BoneIndex : Pose.ForEachBoneIndex())
	{
		FBoneReference& BoneReference = BoneToModifies[BoneIndex.GetInt()];
		const FName& SkeletonBoneName = BoneReference.BoneName;

		FTransform NewBoneTM = Output.Pose.GetComponentSpaceTransform(BoneIndex);

		FRotator& Rotation = *BoneList.Find(SkeletonBoneName); //TMap<FName, FRotator> BoneList		

		if (&Rotation != nullptr)
		{
			FTransform ComponentTransform = Output.AnimInstanceProxy->GetComponentTransform();			
			FAnimationRuntime::ConvertCSTransformToBoneSpace(ComponentTransform, Output.Pose, NewBoneTM, BoneIndex, RotationSpace);

			FString HandBoneName = SkeletonBoneName.ToString();

			if (WhichHandChecked == 0)
				NewBoneTM.SetRotation(NewBoneTM.GetRotation() * FQuat(Rotation));
			else if (WhichHandChecked == 1 && HandBoneName.Contains("_l"))
				NewBoneTM.SetRotation(FQuat(Rotation));
			else if (WhichHandChecked == 2 && HandBoneName.Contains("_r"))
				NewBoneTM.SetRotation(FQuat(Rotation));
			else if (WhichHandChecked == 3 && (HandBoneName.Contains("_l") || HandBoneName.Contains("_r")))
				NewBoneTM.SetRotation(FQuat(Rotation));

			FAnimationRuntime::ConvertBoneSpaceTransformToCS(ComponentTransform, Output.Pose, NewBoneTM, BoneIndex, RotationSpace);
		}

		Temp.Emplace(FBoneTransform(BoneIndex, NewBoneTM));
		Output.Pose.LocalBlendCSBoneTransforms(Temp, Alpha);
		Temp.Reset();
	}
}

```

2-2.Output.Pose.GetComponentSpaceTransform() retrieves the current World Transform of the bone.  
2-3.With FAnimationRuntime::ConvertCSTransformToBoneSpace(), I changed the world transform of the bone to BoneSpace and applied the local rotation value of the V pose (relative to RTS\_ParentBoneSpace).  
2-4.ConvertBoneSpaceTransformToCS() changes the Transform of Bone operating in BoneSpace to Component Space.  
Updated the pose with 2-5.LocalBlendCSBoneTransforms().

 ![20221122_153858](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/e/1/0e199389b9acb29fb7a4ae3fe7766627eb2732ef.png)  
 ![20221123_195928](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/9/349d714ec64d1407e93f06391100191feeeddbd3.png)  
Until now, the character’s fingers cannot represent the V pose…;o;  
Could you please tell me how you changed and set the local rotation of the bone?  
I would be very happy if you could give me even the smallest hint.
