Add specific amount of rotation to a specific direction

Hi,

I want to rotate a mesh to a specific direction that I store in a variable after doing some math. The direction could be either X or Y.

I have the direction vector in a variable.

I want to add 90 to the rotation of the mesh in this direction.

Can someone help me?

This should do the rotation for you if this object is part of some actor, and you want to do relative rotation inside of an actor


If you want to change world rotation of the object, use this instead of SetRelativeRotation
image

RotationSpeed should be between 0 and 1, and DesiredRotation is any target rotation you need.

Hmm, not quite.

I want it to rotate by 90 degrees (Or another specific value) based on the direction I get (vector) from my math logic.

Basically when I interact with it the pillar rotate by 90 degrees on the opposite direction of the player.

Then you can use FindLookAtRotation and just interpolate to it? It is even simpler. Just make sure your Target vector is the location at which your object should look at, and Start is object’s current location.

More info: WTF Is? Find Look at Rotation in Unreal Engine 4 ( UE4 ) - YouTube