Regular API function

simHandleProximitySensor

Description Handles (performs sensing, etc. of) a registered proximity sensor object. See also simReadProximitySensor, simCheckProximitySensor, simCheckProximitySensorEx and simResetProximitySensor.
C synopsis simInt simHandleProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* detectedSurfaceNormalVector)
C parameters
sensorHandle: handle of a proximity sensor object or sim_handle_all or sim_handle_all_except_explicit. (sim_handle_all will handle all proximity sensor objects, while sim_handle_all_except_explicit will only handle those that are not marked as "explicit handling")
detectedPoint: coordinates of the closest detected point (x, y and z: detectedPoint[0]-detectedPoint[2]) relative to the sensor reference frame, and distance to the detected point (1 value: detectedPoint[3]). Can be NULL
detectedObjectHandle: handle of the object that was detected. Can be NULL
detectedSurfaceNormalVector: normal vector (normalized) of the detected surface. Relative to the sensor reference frame. Can be NULL

When several proximity sensors are handled at the same time (e.g. with the sim_handle_all argument), then the output values are relative to the closest detection distance
C return value
0 if nothing was detected, -1 in case of an error. In a future release, a more detailed return value might be available
Lua synopsis number result,number distance,table_3 detectedPoint,number detectedObjectHandle,table_3 detectedSurfaceNormalVector=simHandleProximitySensor(number sensorHandle)
Lua parameters
sensorHandle: handle of a proximity sensor object or sim_handle_all or sim_handle_all_except_explicit. (sim_handle_all will handle all proximity sensor objects, while sim_handle_all_except_explicit will only handle those that are not marked as "explicit handling")
Lua return values
result: 0 if nothing was detected, -1 in case of an error. In a future release, a more detailed return value might be available
distance: distance to the detected point if result is >0, nil otherwise
detectedPoint: table of 3 numbers indicating the relative coordinates of the detected point if result is >0, nil otherwise
detectedObjectHandle: handle of the object that was detected if result is >0, nil otherwise
detectedSurfaceNormalVector: normal vector (normalized) of the detected surface. Relative to the sensor reference frame. Is nil if result is <1

When several proximity sensors are handled at the same time (e.g. with the sim_handle_all argument), then the return values are relative to the closest detection distance

All regular API functions on one page