Description
Wiki Description
Calculates the distance between this object and the passed in one.
Documentation Comment
Calculates the distance between this reference and another - both must either be in the same interior, or same worldspace
Caveats
CK Wiki - Notes
- If you are wanting to know when something is closer or farther then a specified distance from another one, you should instead use RegisterForDistanceLessThanEvent or RegisterForDistanceGreaterThanEvent instead of constantly checking the distance using this function manually which is less efficient.
- Calling this function on an actor to check the distance of an objectreference will result in distance larger than expected. Where as calling said objectreference on an actor(even the same actor) will return a correct value. Source
Parameters
Examples
; 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")Auto-Generated Example
ObjectReference myObjectReference__akOther
float returnedValue = myObjectReference__toCallFunctionOn.GetDistance(myObjectReference__akOther)Related Pages
Additional References
View this function’s page on the Fallout 4 Creation Kit Wiki
