No announcement yet.

How do I convert Rotational Axis XYZ with the Rotational Angle to an Unreal rotator?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I convert Rotational Axis XYZ with the Rotational Angle to an Unreal rotator?


    I've been having some issues converting the RotAxis values into a proper rotator for the leaves in Unreal editor.
    What do I exactly need to script into my blueprint for it to align to like what I'm seeing in Speedtree?



  • #2

    Do you mean the leaf reference rotation in XML files? Those are just axis/angle representation.

    While we can't really help with specifics in your blueprint, there is an axis/angle to rotator node you could look into. But then you might need to adjust for coordinate systems, depending on your settings.


    • #3
      Hi Greg,

      Yes, I am indeed referring to the leaf reference rotations in XML files. I looked into the axis/angle rotator node that you mentioned and unfortunately couldn't get it to work.

      For example:

      The values from the XML I'm getting for the first leaf, the position is correct, only thing I had to do was flip the Y on export and switch to centimeters which is the Unreal unit we're using.
      For that same leaf however I'm getting:

      and when I input those into the Axis Vec3 of the node along with the angle, the rotator comes out incorrectly, almost like 90 degrees offset, but not exactly 90 degrees either.

      I've tried reversing that logic in BP, I rotated the leaf manually to match the intended position, overlapping it with a full tree geo I exported from Speedtree into Unreal, and then got the rotations axis and angle through the Quaternion and it's giving me different values than the XML.
      X=-0.185 Y=0.123 Z=-0.975
      Rot Angle: 1.086002

      A guide on how to recompose the rotator for Unreal would be much appreciated if possible, or maybe have the XML exporter also output a rotator value for Unreal specifically would be great
      With how UE5 is going the way of Nanite geometry, we're trying to reduce memory footprint as much as possible.
      Thanks in advance!