Difference between revisions of "GetDistance - ObjectReference"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jlundin
 
imported>Mr6
 
Line 3: Line 3:
'''Member of:''' [[ObjectReference Script]]
'''Member of:''' [[ObjectReference Script]]


Calculates the distance between this object and the passed in one.
Calculates the distance in [[unit|units]] between this object and the passed in one.


== Syntax ==
== Syntax ==

Latest revision as of 21:57, 22 February 2012

Member of: ObjectReference Script

Calculates the distance in units between this object and the passed in one.

Syntax[edit | edit source]

float Function GetDistance(ObjectReference akOther) native

Parameters[edit | edit source]

  • akOther: The object to find the distance to.

Return Value[edit | edit source]

The distance between this object and the other one. (Objects should be in the same interior, or same worldspace, otherwise this will be a very large number)

Examples[edit | edit source]

; Find out how far away the player is from the chest (assuming they are in the same interior or worldspace)
Debug.Trace("Player is " + Game.GetPlayer().GetDistance(Chest) + " units away from the chest")

See Also[edit | edit source]