Regular API function
simCheckProximitySensorEx / sim.checkProximitySensorEx
Description
|
Checks whether the proximity sensor detects the indicated entity. This is the extended functionality version of sim.checkProximitySensor. Detection is silent (no visual feedback) compared to sim.handleProximitySensor. Also, the detectable flags of the entity are overridden if the entity is an object. see also sim.readProximitySensor and sim.checkProximitySensorEx2.
|
C/C++ synopsis
|
simInt simCheckProximitySensorEx(simInt sensorHandle,simInt entityHandle,simInt detectionMode,simFloat detectionThreshold,simFloat maxAngle,simFloat* detectedPoint,simInt* detectedObjectHandle,simFloat* surfaceNormalVector)
|
C/C++ parameters |
sensorHandle: handle of the proximity sensor object
entityHandle: handle of entity to detect (object or collection), or sim.handle_all to detect all detectable objects
detectionMode: bit coded: bit0 (1) for front face detection, bit1 (2) for back face detection (bit0|bit1 needs to be true), bit2 (4) for fast detection (doesn't search for the closest point, just any point in the detection volume), bit3 (8) for limited angle detection (if set, maxAngle is taken into account).
detectionThreshold: doesn't detect objects farther than detectionThreshold distance from sensor origin
maxAngle: maximum detection angle (angle between detection ray and normal vector of the surface). Can be (0;pi/2). Only if bit3 of detectionMode is set will this parameter have an effect. Use this to realistically simulate ultrasonic sensors.
detectedPoint: coordinates of detected point relative to the sensor origin (detectedPoint[0]-detectedPoint[2]), and distance of detected point to the sensor origin (detectedPoint[3]). Can be nullptr
detectedObjectHandle: handle of detected object (useful when entity to be detected is a collection or sim.handle_all). Can be nullptr
surfaceNormalVector: normal vector of the surface where the point was detected. Normalized. Relative to the sensor reference frame. Can be nullptr
|
C/C++ return value
|
-1 if operation was not successful, otherwise 0 (no detection) or 1 (detection)
|
Lua synopsis
|
int result,float distance,float[3] detectedPoint,int detectedObjectHandle, float[3] surfaceNormalVector=sim.checkProximitySensorEx(int sensorHandle,int entityHandle,int detectionMode,float detectionthreshold,float maxAngle)
|
Lua parameters |
sensorHandle: handle of the proximity sensor object
entityHandle: handle of entity to detect (object or collection), or sim.handle_all to detect all detectable objects
detectionMode: bit coded: bit0 (1) for front face detection, bit1 (2) for back face detection (bit0|bit1 needs to be true), bit2 (4) for fast detection (doesn't search for the closest point, just any point in the detection volume), bit3 (8) for limited angle detection (if set, maxAngle is taken into account).
detectionThreshold: doesn't detect objects farther than detectionThreshold distance from sensor origin
maxAngle: maximum detection angle (angle between detection ray and normal vector of the surface). Can be (0;pi/2). Only if bit3 of detectionMode is set will this parameter have an effect. Use this to realistically simulate ultrasonic sensors.
|
Lua return values
|
result: 0 (not detected) or 1 (detected)
distance: distance from the sensor origin to the detected point. Is nil if result is different from 1
detectedPoint: position of the detected point relative to the sensor origin. Is nil if result is different from 1
detectedObjectHandle: handle of detected object. Is nil if result is different from 1
surfaceNormalVector: normal vector of the surface where the point was detected. Normalized. Relative to the sensor reference frame. Is nil if result is different from 1
|
Python synopsis |
int result,float distance,list detectedPoint,int detectedObjectHandle, list surfaceNormalVector=sim.checkProximitySensorEx(int sensorHandle,int entityHandle,int detectionMode,float detectionthreshold,float maxAngle) |
|