Regular API function

simReadDistance (remote API equivalent: simxReadDistance)

Description Reads the distance of a registered distance object. This function doesn't perform distance measurement, it merely reads the result from a previous call to simHandleDistance (simHandleDistance is called in the default main script). See also simResetDistance and simCheckDistance.
C synopsis simInt simReadDistance(simInt distanceObjectHandle,simFloat* smallestDistance)
C parameters
distanceObjectHandle: handle of the distance object
smallestDistance: smallest distance (valid only if return value is different from -1)
C return value
different from -1 if distance was read, -1 in case of an error.
Lua synopsis number result,number smallestDistance=simReadDistance(number distanceObjectHandle)
Lua parameters
Same as C-function
Lua return values
result: 1 if distance was read, -1 in case of an error, and 0 if simHandleDistance was never called, or if simResetDistance was previously called.
smallestDistance: the smallest distance. Is nil if result is not 1

All regular API functions on one page