How do I properly define a Rotator (Rotation) variable in Verse and get it's Pitch, Roll and Yaw values?

I quite don’t understand how Rotator variable types work in Verse. The documentation provided on the matter is lacking and I am still learning Verse in general.

From what I understand, creating a variable like this defines a Rotator with 0 value in Pitch, Roll and Yaw.

var NewRotator : rotation = rotation{}

I can also make use of the method MakeRotator() to create a rotation type variable too.

However, I can’t figure out how I can break this rotator and get the individual Axis inside the variable. For example, I have a fort_character rotation variable and I want to get the Yaw value of it.

Which method or property do you use to get this float value?

You can use like this

InitialRotation:rotation = MakeRotation(vector3{X:=0.0, Y:=0.0, Z:=-1.0}, 1.5708)

The second argument is in AngleRadians

So I did this

ConvertAngleToRadians(angleDegrees: float): float =
    var PI: float = 3.141592653589793
    angleDegrees * (PI / 180.0)

InitialRotation:rotation = MakeRotation(vector3{X:=0.0, Y:=0.0, Z:=-1.0}, ConvertAngleToRadians(90.0))

There are functions provided to work with them.

To create a specific rotation use

MakeRotationFromYawPitchRollDegrees(180.0, 0.0, 0.0)

There’s a version for radians too I think.

To get the components of a rotation use the following, which returns a float array with the values.

MyRotation.GetYawPitchRollDegrees()

You can also do things like this, applying a rotation to an existing rotation.

set aTrans.Rotation = mBoard.GetTransform().Rotation.ApplyYaw(3.14159)

In the VS Editor if you control click on a Epic defined item, such as "rotation’, it will open the associated Verse digest where you can see what else is provided by looking around in there.

1 Like