Regular API function
simReadProximitySensor / sim.readProximitySensor
Description
|
Reads the state of a proximity sensor. This function doesn't perform detection, it merely reads the result from a previous call to sim.handleProximitySensor (sim.handleProximitySensor is called in the default main script). See also sim.checkProximitySensor, sim.checkProximitySensorEx and sim.resetProximitySensor.
|
C/C++ synopsis
|
simInt simReadProximitySensor(simInt sensorHandle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* detectedSurfaceNormalVector)
|
C/C++ parameters |
sensorHandle: handle of a proximity sensor object
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 nullptr
detectedObjectHandle: handle of the object that was detected. Can be nullptr
detectedSurfaceNormalVector: normal vector (normalized) of the detected surface. Relative to the sensor reference frame. Can be nullptr
|
C/C++ return value
|
|
Lua synopsis
|
int result,float distance,float[3] detectedPoint,int detectedObjectHandle,float[3] detectedSurfaceNormalVector=sim.readProximitySensor(int sensorHandle)
|
Lua parameters |
Similar to the C-function counterpart
|
Lua return values
|
distance: distance to the detected point
detectedPoint: table of 3 numbers indicating the relative coordinates of the detected point
detectedObjectHandle: handle of the object that was detected
detectedSurfaceNormalVector: normal vector (normalized) of the detected surface. Relative to the sensor reference frame.
|
Python synopsis |
int result,float distance,list detectedPoint,int detectedObjectHandle,list detectedSurfaceNormalVector=sim.readProximitySensor(int sensorHandle) |
|