Difference between revisions of "Talk:GetPositionX - ObjectReference"

Jump to navigation Jump to search
Removed my last edit and added a working function.
imported>Lisselli
m
imported>Lisselli
(Removed my last edit and added a working function.)
Line 3: Line 3:
If you want to convert an object's in game coordinates to use in the Cell View window, you divide the X and Y values by 4096 and cast as int to remove the decimals.
If you want to convert an object's in game coordinates to use in the Cell View window, you divide the X and Y values by 4096 and cast as int to remove the decimals.
[[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]])[[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]]) 2017-10-06T11:57:52 (EDT)
[[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]])[[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]]) 2017-10-06T11:57:52 (EDT)
: When going past the origin cell(0,0), negative coordinates in the editor do not match the coordinates given by objects X and Y values. (-11, -2, is -10, -1). Example: X: -44675.6289 and Y: -5729.0830 for this object, when converted into coordinates(X / 4096, and Y/4096), are 10.9 and 1.3, even though the object is located in cell -11,-2 in the editor. This may be just a mishap the Cell View window when the coordinates were codded in. When on the positive side of the game's coordinate plane, the X and Y conversions(positive Y) match their respect coordinates seen in the editor. [[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]]) 2017-10-11T09:06:01 (EDT)
 
== GetCoordinateX ==
<source lang="papyrus">
Float Function GetCoordinateX(ObjectReference akRef)
    ; Converts the object's position to the X coordinate of the cell.
    return Math.Floor(akRef.GetPositionX() / 4096.0)
EndFunction
</source>
Use this to get the exact X coordinate for the cell. To be used only for exterior cells. [[User:Lisselli|Lisselli]] ([[User talk:Lisselli|talk]]) 2017-10-27T06:31:57 (EDT)
Anonymous user

Navigation menu