Talk:GetPositionY - ObjectReference

From the CreationKit Wiki
Revision as of 11:27, 27 October 2017 by imported>Lisselli (→‎GetCoordinateY: Changed Function type Float to Int, since the return values are all floats cast to int.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GetCoordinateY[edit source]

Int Function GetCoordinateY(ObjectReference akRef)
    ; Converts the objects' Y position to the Y coordinate of the cell.
    Float GetPosY = akRef.GetPositionY() / 4096.0
    If GetPosY >= 0.0
        Return GetPosY as Int
    Else
        Return Math.Floor(GetPosY)
    EndIf
EndFunction

Use this to get the exact Y coordinate for the cell. Use only for exterior cells. Takes negative values into account. Lisselli (talk) 2017-10-27T12:18:47 (EDT)