C++: How to point a mesh into s specific direction using all 3 rotation axis?

C++: How to point a mesh into s specific direction using all 3 rotation axis ?

Hi,

i am totally new to UE4 C++, so sorry for asking noob questions…

I am trying to make a Radar-Antenna animation in C++…

What i managed to archive so far:

  1. Placing an actor with a mesh in the UE4 Editor

  2. Manipulate the actor with C++ Code, changing Position with a Vectors work fine.

  3. Rotate the mesh using the FRotator.ROLL in the Ticker works fine too… I get a rotating mesh in the right place so far.

  4. At least i want to make the antenna sway up and down using the pitch rotation.
    That code gives me a weird reaction, so the antenna pitches up and down fine while starting, at 90 mesh degree roll it only twists itself.

I think, that the base orientation of the Pitch-Axis is not changing with the mesh is rotating around the rolling axis, it always refers to the spwan position of the actor

Is there a solution, to have the y-axis always depend on the poition of the x-axis, i.e. rotate it with any rotation input ?

Try to use this :slight_smile:

FRotator Rotation = UKismetMathLibrary::FindLookAtRotation(Start, LookAtPoint);

Thanks, this works for me.