simCheckProximitySensorEx2

Checks whether the proximity sensor detects the indicated points, segments or triangles. Detection is silent (no visual feedback)

C++ synopsis

int simCheckProximitySensorEx2(int sensorHandle, double* vertexPointer, int itemType, int itemCount, int detectionMode, double detectionThreshold, double maxAngle, double* detectedPoint, double* normalVector)

Arguments

  • sensorHandle: handle of the proximity sensor object
  • vertexPointer: a pointer to vertices
  • itemType: 0 for points, 1 for segments and 2 for triangles
  • itemCount: the number of items that vertexPointer points at
  • 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
  • normalVector: normal vector of the surface where the point was detected. Normalized. Relative to the sensor reference frame. Can be nullptr

Return

  • -1 if operation was not successful, otherwise 0 (no detection) or 1 (detection)


See also: