Difference between revisions of "GetAngle"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>SJML Bot
(Bot creating condition functions pages.)
 
imported>Jimhsu
 
(2 intermediate revisions by 2 users not shown)
Line 8: Line 8:




'''Special Notes (relative to GetAngle called upon the player)'''
== Notes ==
*Z angle returns a value from 0 to 360 depending on the player's current heading. Z angle is measured with the positive ''y''-axis as 0 and increasing clockwise from there. In the Tamriel worldspace, this is North, however, the same is not true of interiors (other exterior worldspaces have not been tested) - GetAngle is based on the game's coordinate system and the Compass is based on the NorthMarker object in each cell. Therefore, GetAngle Z is only useful for determining compass directions in the exterior Tamriel worldspace.
* Z angle returns a value from 0 to 360 depending on the player's current heading. Z angle is measured with the positive ''y''-axis as 0 and increasing clockwise from there.
*Trigonometry with the Z angle could be done using the following conversion formula:
** In the Tamriel worldspace, a Z angle of 0 is North, however, the same is not true of interiors (other exterior worldspaces have not been tested) - GetAngle is based on the game's coordinate system and the Compass is based on the NorthMarker object in each cell. Therefore, GetAngle Z is only useful for determining compass directions in the exterior Tamriel worldspace.
** Note that standard mathematical notation has 0 starting on the ''x''-axis, rather than the ''y''-axis, and increases counter-clockwise, not clockwise. Trigonometry with the Z angle thus requires using the following conversion formula:
  float GetAngleZ  ;the game's version
  float GetAngleZ  ;the game's version
  float TrigAngleZ ;the rest of the world's interpretation of the same
  float TrigAngleZ ;the rest of the world's interpretation of the same
   
   
  set GetAngleZ to player.GetAngle Z
  GetAngleZ = player.GetAngle Z
  if ( GetAngleZ < 90 )
  if ( GetAngleZ < 90 )
   set TrigAngleZ to 90 - GetAngleZ
   TrigAngleZ = 90 - GetAngleZ
  else
  else
   set TrigAngleZ to 450 - GetAngleZ
   TrigAngleZ = 450 - GetAngleZ
  endif
  endif
*X angle returns a value (theorically) from -90 to 90.  The true in-game range is -89 to 89, with -89 if the player is looking above himself, and 89 if player is looking at his feet. Note that the player actually ''is'' looking 89 degrees above or below horizontal - you cannot look exactly up or exactly down in game.
* X angle returns a value (theorically) from -90 to 90.  The true in-game range is -89 to 89, with -89 if the player is looking above himself, and 89 if player is looking at his feet. Note that the player actually ''is'' looking 89 degrees above or below horizontal - you cannot look exactly up or exactly down in game.
*NOTE: You can rotate the camera when riding a horse without changing the actual direction the player's facing so GetAngle Z is kind of useless sometimes (like when using [[getLOS]]) if the player is on a horse.
* NOTE: You can rotate the camera when riding a horse without changing the actual direction the player's facing so GetAngle Z is kind of useless sometimes (like when using [[getLOS]]) if the player is on a horse.
* GetAngle x does not work on horses or the player if the player is mounted, in 1st or 3rd person mode. Unknown whether or not this is a bug.
 
==Papyrus Version==
==Papyrus Version==
[[GetAngleX - ObjectReference]]<br/>
[[GetAngleX - ObjectReference]]<br/>

Latest revision as of 17:36, 14 February 2012

Syntax:

GetAngle axis 

Example:

GetAngle Z 


Returns the current world rotation angle of the object on the selected axis (X, Y, or Z) in float.


Notes[edit | edit source]

  • Z angle returns a value from 0 to 360 depending on the player's current heading. Z angle is measured with the positive y-axis as 0 and increasing clockwise from there.
    • In the Tamriel worldspace, a Z angle of 0 is North, however, the same is not true of interiors (other exterior worldspaces have not been tested) - GetAngle is based on the game's coordinate system and the Compass is based on the NorthMarker object in each cell. Therefore, GetAngle Z is only useful for determining compass directions in the exterior Tamriel worldspace.
    • Note that standard mathematical notation has 0 starting on the x-axis, rather than the y-axis, and increases counter-clockwise, not clockwise. Trigonometry with the Z angle thus requires using the following conversion formula:
float GetAngleZ  ;the game's version
float TrigAngleZ ;the rest of the world's interpretation of the same

GetAngleZ = player.GetAngle Z
if ( GetAngleZ < 90 )
  TrigAngleZ = 90 - GetAngleZ
else
  TrigAngleZ = 450 - GetAngleZ
endif
  • X angle returns a value (theorically) from -90 to 90. The true in-game range is -89 to 89, with -89 if the player is looking above himself, and 89 if player is looking at his feet. Note that the player actually is looking 89 degrees above or below horizontal - you cannot look exactly up or exactly down in game.
  • NOTE: You can rotate the camera when riding a horse without changing the actual direction the player's facing so GetAngle Z is kind of useless sometimes (like when using getLOS) if the player is on a horse.
  • GetAngle x does not work on horses or the player if the player is mounted, in 1st or 3rd person mode. Unknown whether or not this is a bug.

Papyrus Version[edit | edit source]

GetAngleX - ObjectReference
GetAngleY - ObjectReference
GetAngleZ - ObjectReference