Regular API function

simGetClosestPositionOnPath

Description Retrieves the intrinsic relative position on a path that is closest to the specified point. The returned value is dependent on the selected path length calculation method for the given path object. See also simGetPathPosition, simGetPathLength, simGetPositionOnPath and simGetOrientationOnPath.
C synopsis simInt simGetClosestPositionOnPath(simInt pathHandle,simFloat* relativePosition,simFloat* pathPosition)
C parameters
pathHandle: handle of the path object
relativePosition: a point in coordinates (x, y and z) relative to the path object position
pathPosition: (return value). The intrinsic relative position on the path, a value between 0 and 1, where 0 is the beginning of the path, and 1 the end of the path (that value is dependent on the selected path length calculation method).
C return value
-1 if operation was not successful. In a future release, a more differentiated return value might be available
Lua synopsis number positionOnPath=simGetClosestPositionOnPath(number pathHandle,table_3 relativePosition)
Lua parameters
pathHandle: handle of the path object
relativePosition: a table containing a point in relative coordinates (x, y and z)
Lua return values
positionOnPath: the intrinsic relative position on the path, a value between 0 and 1, where 0 is the beginning of the path, and 1 the end of the path (value is dependent on the selected path length calculation method), or nil in case of an error.

All regular API functions on one page