How to get the rotation value of an object

If i set the Yaw Rotation value of an object in the editor to 45°.
How can i get that 45° yaw value with verse?

Object.GetTransform().Rotation.X
Object.GetTransform().Rotation.Yaw

something like this wont work.
Someone knows how to get the yaw value of the object?

Use GetYawPitchRollDegrees() on the rotation which will return a vector3{} with the values.

Here’s an example of checking Yaw (ignore xy_dir, that’s my own thing).

    Rot_To_XYDir(pRot : rotation) : xy_dir =
        aYPR := pRot.GetYawPitchRollDegrees()

        if (aYPR[0] < 45.0):
            # Yaw less than 45 degrees

There’s a version that return Radians I think too.

Thanks a lot for the answer. I was expecting to always get the values from the editor, but the differ.

Yaw = 90°, Pitch = -90°, Roll = 0°
give me the exact value back

Yaw = 45°, Pitch = -90°, Roll = 0°
I get those, which are different:
Yaw = 26.565°, Pitch = -90°, Roll = 18.43°

Maybe Im missing some important detail. Any idea how to get those exact values back?

        aYPR := TriggerH.GetTransform().Rotation.GetYawPitchRollDegrees()
        if(Yaw := aYPR[0]):
            Print("Yaw  {Yaw}")
        if(Pitch := aYPR[1]):
            Print("Pitch  {Pitch}")
        if(Roll := aYPR[2]):
            Print("Roll  {Roll}")

I don’t know what causes that, unless they are world versus relative coordinates maybe, or the object moved (rotated) after it was set in the editor.

I’ve not seen it be inaccurate in the things I’ve done so far.

Hmm to bad, not sure why my behaves like that. Couldn’t fix my issue yet.
I still mark ur answer as the solution, it might be the solution for many other related things.
Thanks for helping.

You’re showing it in the editor, is it a creative prop then? And you’re sure it hasn’t moved in the world by the time the Verse code runs?

Did you check what the world and relative rotations are - just in case one of the two is what Verse shows?

  • I’m trying to think of possible explanations. :slight_smile: