• News

• Industries

• Learning & Support

• Community

• Marketplace

# Lean towards object - rotation problem

Meet Bobs. I would like to make them lean towards the sphere, but not in this way:

For example, look at the right Bob. He’s twisting when rotating - in result, he lays on his back when 100% leaned.
… And that’s how he should lean:

For now, they get LookAt rotation -> UpVector -> Rotator, but probably it’s not a good way to go with this.
I want to retain local rotation of the actors while they lean towards a point and the lean rotation to be relative to current actor rotation, something like this:

I’ve tried adding/substracting rotation and some other hacky tries, but none worked.

I can’t figure it out… I guess that my brain just turned into scrambled eggs.
I would be grateful if some more math-oriented hero could provide some hints on how to calculate rotation in this way.

Update: I’ve just discovered that there is a material that does a very similar thing in Content Examples -> PivotPainter level. It uses ‘RotateAboutAxis’ node, so it might be a clue, but there is no Blueprint equivalent of this node:

^ That’s what I want to achieve (but without bending) - no matter what local rotation is, it always leans towards the same point. But i can’t use material for this, because I need other objects to inherit the rotation when attached.

You should probably show your blueprint as well to better visualize how you are doing this.

Sure:

I’ve tried implementing some equivalent of this material function that I’ve attached in the first post (bending palm trees), but with no luck

I feel like this shouldn’t be that hard to achieve, but maybe i’m wrong… Basically, this is my goal:

(Ignore the red arrows)
Any clues?