Talk:GetAngleZ - ObjectReference

Active discussions

Place objects in the direction you are lookingEdit

float GameX = PlayerRef.GetAngleX()
float GameZ = PlayerRef.GetAngleZ()
float AngleX = 90 + GameX            ;needed because without it, X rotation reads -90 to 90. We need it to read 0 to 180.
if GameZ < 90            ;needed to convert Skyrim's Z rotation to a notation we can use in trigonometric functions and calculus.
    AngleZ = 90 - GameZ
else
    AngleZ = 450 - GameZ
endIf
ObjectYouWant.MoveTo(PlayerRef, DistanceVar * Math.Sin(AngleX) * Math.Cos(AngleZ), DistanceVar * Math.Sin(AngleX) * Math.Sin(AngleZ), DistanceVar * Math.Cos(AngleX))            ;We might want to add a float equal to the actor's height - 35 to raise the object to roughly chest level. If you will do this, add it to the Z offset parameter.

Source: https://www.reddit.com/r/skyrimmods/comments/k8nvb3/some_calculus_that_can_help_modders_with_moveto/

Return to "GetAngleZ - ObjectReference" page.