# Code to put in actor class to rotate a certain bone

**URL:** <https://forums.unrealengine.com/t/code-to-put-in-actor-class-to-rotate-a-certain-bone/428601>\
**Category:** Character & Animation\
**Tags:** skeletalmeshcomponen, unreal-engine, skeletalmesh, UE4, CPP, question\
**Created:** [July 3, 2018, 1:40pm UTC](https://forums.unrealengine.com/t/code-to-put-in-actor-class-to-rotate-a-certain-bone/428601 "2018-07-03T13:40:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_fc2539f0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_fc2539f0](https://forums.unrealengine.com/u/anonymous_user_fc2539f0)\
**Post date:** [July 3, 2018, 1:40pm UTC](https://forums.unrealengine.com/t/code-to-put-in-actor-class-to-rotate-a-certain-bone/428601/1 "2018-07-03T13:40:24Z")

</div>

I am trying to write code that will rotate certain bones of a vertical robot arm around either the y or z axis. This code will create variables that will be added to an animation blueprint. The only problem is, I’m not knowledgeable enough in Unreal and even C++ to know how to write the code that will have that functionality. Does anyone have any sample code to put in the actor class about how I could rotate certain bones like that?

---

<div class="post-metadata">

**Author:** ![guansdu](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@guansdu](https://forums.unrealengine.com/u/guansdu)\
**Post date:** [August 10, 2018, 3:55am UTC](https://forums.unrealengine.com/t/code-to-put-in-actor-class-to-rotate-a-certain-bone/428601/2 "2018-08-10T03:55:28Z")

</div>

with `USkeletalMeshComponent`, you can use `Transform(Modify) Bone` in blueprint.

with `UPoseableMeshComponent`, you can use `GetBoneNames()`and `SetBoneRotationByName()` in C++.
