Regular API function

simGetClosestPosOnPath / sim.getClosestPosOnPath

Description Returns the position or distance along a path that is closest to a specified point in space. See also the other path related functions.
C/C++
synopsis
float simGetClosestPosOnPath(const simFloat* path,simInt pathSize,const simFloat* pathLengths,const simFloat* absPt)
C/C++
parameters
path: the path, specified in row-major order, with x/y/z values for each path point
pathSize: the size/length of the path pointer
pathLengths: the lengths of a path. Each path point should have a corresponding length value (as the distance from the path's first point, along the path). See also sim.getPathLengths.
absPt: a point in 3D space
C/C++
return value
The position/distance along the path
Lua
synopsis
float posAlongPath=sim.getClosestPosOnPath(float[] path,float[] pathLengths,float[3] absPt)
Lua
parameters
Similar to the C-function counterpart
Lua
return values
Similar to the C-function counterpart
Python
synopsis
float posAlongPath=sim.getClosestPosOnPath(list path,list pathLengths,list absPt)