object.get_distance_to

This function returns the distance between the context object and the object supplied as an argument. The distance is measured in tenths of Forge units, i.e. a value of 10 represents 1.0 units in Forge.

This function returns number. Calling this function without storing its return value in a variable is an error.

Arguments

other

An object in the game world.

Example

global.number[0] = current_object.get_distance_to(global.object[0])
if global.number[0] < 10 then
   --
   -- The objects are close!
   --
end

Notes

See also