How to interact with rotation values in Verse?

Hello, i was curious, is it possible to Add/Subtract/Multiply from rotation values. Something similar you would do with position values. And if so, how?

Here’s my example. I’m trying to make prop face same direction as the player but i would like to limit rotation only by X and Y, so it won’t face up and down. My idea was to multiply Z axis by zero so it wouldn’t move, but it didn’t work. Is there other solution?

Thanks in advance!

1 Like

Other issue i encountered is that prop will lose it’s view rotation properties if player rotation values will go over 90 or -90 degrees on any axis

The currently exposed functionality to manipulate rotations can be found here SpatialMath module.

In your exact example if you don’t want the prop to face up or down you just want to remove the pitch from the player’s view rotation. This can be achieved with code like this:

    MoveTheProp(ThePlayer:fort_character)<suspends>:void=
        loop:
            Sleep(0.0)

            PitchYawRollView := ThePlayer.GetViewRotation().GetYawPitchRollDegrees()
            if:
                LimitedViewRotation := MakeRotationFromYawPitchRollDegrees(PitchYawRollView[0], 0.0, PitchYawRollView[2])
                FollowerProp.TeleportTo[ThePlayer.GetTransform().Translation, LimitedViewRotation]
3 Likes

Thank you so much!

1 Like