How to rotate with retaining local rotation?

Updated question: How to rotate an actor towards a point with retaining its local rotation? Here’s a more in-depth explanation:

This is why I need this: Lean towards object - rotation problem - Blueprint - Unreal Engine Forums

[original question, because this node does the job (more in the thread above)] I would like to rotate objects the same way as ‘RotateAboutAxis’ node from material editor does, but there is no ‘RotateAboutAxis’ node in blueprints. How to recreate the behavior of RotateAboutAxis node in blueprints?

I would be grateful for some help.

Try using a rotation node and only add or set the rotation along the axis you want to affect. From the add or set rotation node right-click on the rotation pin and then select Split Struct Pin to gain access to the individual axis.

To get the rotation the way you want in your thread post you can use the lookat rotation to rotate them to face in the direction of the object on one rotation and then on a separate rotation rotate them only along the axis you are wanting them to bow.

Thanks, but the goal is to preserve any local rotation, so I can’t make them face in the direction of the object. This is what I mean: https://forums.unrealengine.com/attachment.php?attachmentid=83513&d=1457978418

Then don’t rotate them to face the in the direction of the object, instead from the lookat rotation rotate them only on the single axis to perform the bowing, don’t use the up vector you shouldn’t need it, the pitch rotation towards the object is the one you need to rotate along so the lookat rotation should give you yaw so the bow faces the object and the bobs shouldn’t roll at all so that one isn’t needed either.

I must be really dumb in this matter :slight_smile: but I’ve tried this:

… With no luck :frowning:

Don’t say that, sometimes you just have to step back and reevaluate what is going on. Remember that your bobs are always facing their X axis and their X isn’t the same as world X. The LookAt rotation tells you the direction the bowing needs to happen towards, then you need to get which axis of theirs (the bobs) is facing that LookAt direction and add pitch on that axis only to get them to bow towards the object.

Thanks, sounds promising, I will try this, but I can’t figure out how to get (“you need to get which axis of theirs (the bobs) is facing that LookAt direction”) this axis?

Still can’t figure it out… I know that we can compare two vectors by DOT Product (so I can compare the LookAt direction and local actor direction), but how to get which axis it is - no idea :frowning:

Then, I should probably use a node like ‘Rotate About Axis’ or something, but I still need the info on what axis of Bob is facing that LookAt direction…

Thanks for reply! Here’s the effect:

Maybe they need to perform both Pitch & Roll value rotations to be able to bow in the direction, since it probably will be combination of both Roll & Pitch values… But after plugging both Roll & Pitch values, they still don’t rotate correctly, so I don’t know…

Dang…I’m sorry…I had this figured out before in my head and then had to go through some meetings and lost it…Try getting their look at rotation and subtract their look at from their current rotation negate that and then run the bow on that pitch rotation…I don’t think that will do it but try it and let me know what happens

Ok…it shouldn’t be more than one axis…more than one will make them rotate and twist at once…rotating them on their Roll axis will make them rotate to the sides and their feet will go towards the air…pitch will be up and down in the direction they are facing and Yaw will be the rotation of them turning left and right. In their BP are they facing forward in the X axis?

83066-relativeaxis.png

Awesome Bob image! :smiley:

Yes, Bob is facing forward in X axis in its BP:

BTW. If I’m not mistaken, the roll rotation should not make their ‘feet’ go towards the air, since they don’t have their pivot point in the middle, but on their ground level (just like in the image)

I just meant by towards the air if you rotated them completely around…I was trying to describe the rotation directions as best I could. Yeah pivot will be at their feet

Ok I remember what I thought of before…setting up a test map now…are you using a timeline to update the rotation?

That’s great! Yes, i use timeline to lerp between no-rotation and full-bow-towards-a-point rotations, just like shown in my original thread.

Ok, I’m half way there…made progress with getting the rotation we need them to pitch against and the forward vector:

I will have to continue on this later thought I could knock it out real quick but my orbital math is slightly off for the actual bow of the mesh.

Thank you, yes, this is the main problem now - to figure out how to bow towards these LookAt vectors while retaining local rotation.

I will try with some relative rotations now, but it’s almost a blind guessing in my case…

Progress part 2…only a few more steps to go…

Final step is almost done…it will need some more tweeking for the Bobs floating in the air:

You may have to use a float select for the floating Bobs…but that will also require a second set of calculations to return their distance up in Z from the world Z of the bob point as a starting point then from that add to the degrees of pitch rotation to add to the bow so they bow beyond flat 90 in the facing direction.