Regular API function

simGetVisionSensorDepthBuffer (remote API equivalent: simxGetVisionSensorDepthBuffer)

Description Retrieves the depth buffer (or a portion of it) of a vision sensor. Use simGetVisionSensorResolution to know the resolution of the full depth buffer. The returned data doesn't make sense if simHandleVisionSensor wasn't called previously (simHandleVisionSensor is called by default in the main script if the vision sensor is not tagged as explicit handling).
C synopsis simFloat* simGetVisionSensorDepthBuffer(simInt sensorHandle)
C parameters
sensorHandle: handle of the vision sensor
C return value
depth buffer (buffer size is resolutionX*resolutionY) or NULL in case of an error. The user is in charge of releasing the returned buffer with simReleaseBuffer. Returned values are in the range of 0-1 (0=closest to sensor (i.e. close clipping plane), 1=farthest from sensor (i.e. far clipping plane))
Lua synopsis table depthBuffer=simGetVisionSensorDepthBuffer(number sensorHandle,number posX=0,number posY=0,number sizeX=0,number sizeY=0)
Lua parameters
sensorHandle: handle of the vision sensor. Can be combined with sim_handleflag_codedstring (simply add sim_handleflag_codedstring to sensorHandle), if you wish to retrieve a string buffer (sim_buffer_float) instead of a table. In that case, refer also to simTransformBuffer.
posX / posY: position of the depth buffer portion to retrieve. Zero by default.
sizeX / sizeY: size of the depth buffer portion to retrieve. Zero by default, which means that the full depth buffer should be retrieved
Lua return values
depthBuffer: table containing depth values (table size is sizeX*sizeY), a string containing coded depth values, or nil in case of an error. Returned values are in the range of 0-1 (0=closest to sensor (i.e. close clipping plane), 1=farthest from sensor (i.e. far clipping plane))

All regular API functions on one page