Difference between revisions of "GetAngleZ - ObjectReference"

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search
imported>Tania
imported>Tania
m (→‎Notes: added conversion from skyrim ck wiki)
 
Line 21: Line 21:
</source>
</source>
== Notes ==
== Notes ==
* The range is 90 to -90
*Note that standard mathematical notation has 0 starting on the x-axis, rather than the y-axis, and increases counter-clockwise, not clockwise. Trigonometry (see Math Script) with the Z angle thus requires using the following conversion formula:
<source lang="papyrus">
float GameAngleZ  ;the game's version
float TrigAngleZ ;the rest of the world's interpretation of the same
GameAngleZ = Game.GetPlayer().GetAngleZ()
if ( GameAngleZ < 90 )
  TrigAngleZ = 90 - GameAngleZ
else
  TrigAngleZ = 450 - GameAngleZ
endif
</source>
 
== See Also ==
== See Also ==
*[[ObjectReference Script]]
*[[ObjectReference Script]]

Latest revision as of 01:01, 4 April 2021

Member of: ObjectReference Script

Gets this object's rotation around the z axis.

Syntax[edit | edit source]

float Function GetAngleZ() native

Parameters[edit | edit source]

None.

Return Value[edit | edit source]

This object's rotation around the z axis, in degrees.

Examples[edit | edit source]

Debug.Trace("We are rotated " + GetAngleZ() + " degrees around the Z axis")

Notes[edit | edit source]

  • Note that standard mathematical notation has 0 starting on the x-axis, rather than the y-axis, and increases counter-clockwise, not clockwise. Trigonometry (see Math Script) with the Z angle thus requires using the following conversion formula:
float GameAngleZ  ;the game's version
float TrigAngleZ ;the rest of the world's interpretation of the same
 
GameAngleZ = Game.GetPlayer().GetAngleZ()
if ( GameAngleZ < 90 )
  TrigAngleZ = 90 - GameAngleZ
else
  TrigAngleZ = 450 - GameAngleZ
endif

See Also[edit | edit source]