GetHeadingAngle - ObjectReference: Difference between revisions

Jump to navigation Jump to search
Tried to tweak this to be a bit clearer, and added a visual aid.
imported>Jlundin
 
imported>Egocarib
(Tried to tweak this to be a bit clearer, and added a visual aid.)
Line 3: Line 3:
'''Member of:''' [[ObjectReference Script]]
'''Member of:''' [[ObjectReference Script]]


Gets the angle between this object's heading, and the direction the other object is in, in degrees. If you were to add this angle to this object's rotation around the z axis, and then set the rotation of this object to that - it would be facing the other object.
Returns the angle between this object's current heading, and the direction from this object toward a target object, in degrees. If you were to add the returned angle to this object's current rotation around the z axis, it would then be facing the target object.


== Syntax ==
== Syntax ==
Line 11: Line 11:


== Parameters ==
== Parameters ==
*akOther: The other object to get the angle to.
*akOther: The target object to measure the angle towards.


== Return Value ==
== Return Value ==
The angle in degrees between this object's heading and the other object's direction.
The angle in degrees between this object's heading, and the direction of the target object from this one. Clockwise measures are positive, counterclockwise measures are negative.


== Examples ==
== Examples ==
<source lang="papyrus">
;Assume a view from above:
;
;              C
;              |
;              |
;              |
;            , A------->  (A's heading [A is facing this direction])
;        , '    `
;    , '          `
;  D                `
;                    `
;                      `
;                        B
float fAngle = A.GetHeadingAngle(B) ;fAngle will equal 45.0
float gAngle = A.GetHeadingAngle(C) ;gAngle will equal -90.0
float hAngle = A.GetHeadingAngle(D) ;hAngle will equal 150.0 (approx)
</source>
<source lang="papyrus">
<source lang="papyrus">
; Have the statue face the player
; Have the statue face the player
Anonymous user

Navigation menu