Rotating a staticMeshComponent/actor in his local axis using Blueprint

Hi everyone !

I’ve already asked how to move an actor in his local axis, now I would like to know how to rotate a mesh component, or an actore, in his local rotation axis.

For example, I have an asset, that I want to place multiple times in my level, in different location/rotation, every time I press a button on my controller it rotate each of them by 45 degrees in their local axis (lets say the local Yaw axi).

Using blueprint I can’t find a way to do that, it’s always in world space or parent space, I know I need to get a variable of the actor rotation at construction time, but how would you multiply only one local axi to make it rotate ?

As usual I’ m sure it’s simple, but I can’t find the solution …

Many thanks !

Hi ,

Take a look at this example below.

Create a Variable in the Construction Script that Sets the Relative Rotation of the root component.

13382-ahub_componentrotation01.jpg

To be able to add to the rotation you will need to Break the Rotation > Add to Yaw > then Make the Rotation again. Set the Variable again after the move so you can keep pressing the button and it will keep adding to the rotation.

Make sure to Disable Input Key on which ever key you use.

13384-ahub_componentrotation03.jpg

Sorry, you must have answered while I was typing this up. Anyways, glad you figured it out.

Found the way to do it :slight_smile:

If someone is interest to know how let me know I’ll explain :slight_smile:

Hi Ballard,

Thanks for your reply, I just get it to work then you posted your answer :slight_smile: Good thing is your solution is different than mine and can help later on my project !

Here is how I manage to do it.

I forgot to explain that I need to rotate this mesh depending on the axi value I get from the controller triggers.

Before I had only the mesh component in my BP; I added a child node as parent.

Then, before I used to do like you said, in the construction graph, getting the actor rotation as a variable to reuse in the graph. But I end with this.

Using the relative rotation was not working when the mesh was the only object in my blueprint, but parenting it to something else make it work!

Anyway, thank you for the reply, I appreciate :slight_smile:

Cheers.

You’re welcome. I’m glad it will be of some help. Good luck on your project!

how can you select multiple objects in the view port then rotate them on their individual center points?