Difference between revisions of "Talk:GetAngleZ - ObjectReference"
Jump to navigation
Jump to search
imported>Sein schatten (Created page with "== Place objects in the direction you are looking == <source lang="papyrus"> float GameX = PlayerRef.GetAngleX() float GameZ = PlayerRef.GetAngleZ() float AngleX = 90 + GameX...") |
imported>Sein schatten |
||
Line 11: | Line 11: | ||
endIf | 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. | 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> | </source> | ||
Source: https://www.reddit.com/r/skyrimmods/comments/k8nvb3/some_calculus_that_can_help_modders_with_moveto/ | Source: https://www.reddit.com/r/skyrimmods/comments/k8nvb3/some_calculus_that_can_help_modders_with_moveto/ |
Latest revision as of 01:22, 8 December 2020
Place objects in the direction you are looking[edit source]
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/