problem about how to use the function sim.getPositionOnPath()

Typically: "How do I... ", "How can I... " questions
Post Reply
jianye
Posts: 46
Joined: 16 Oct 2019, 13:58

problem about how to use the function sim.getPositionOnPath()

Post by jianye »

hello,

When I use the coppeliaSim I am trying to use function sim.getPositionOnPath() to get the position information about the control Point but i didn't understan "-ctrlPtIndex-1 " mean?

Code: Select all

Lua parameters	
pathHandle: handle of the path object relativeDistance: a value between 0 and 1, where 0 is the beginning 
of the path,  and 1 the end of the path. 
Make sure you selected the appropriate path length calculation method. 
See also sim.getPathLength. In order to retrieve the position that lies
exactly on a specific path control point, specify following for 
relativeDistance: -ctrlPtIndex-1 (the value will be rounded appropriately).
any advice ?

thanks in advance

Jian Ye

coppelia
Site Admin
Posts: 10339
Joined: 14 Dec 2012, 00:25

Re: problem about how to use the function sim.getPositionOnPath()

Post by coppelia »

Hello Jian Ye,

you have two methods of getting the coordinates of a point on the path:
  • method 1: sim.getPositionOnPath(pathHandle,L), where L is a value between 0 and 1 (0 is at the beginning of the path, 1 is at the end of the path. 0.5 is in the middle of the path, etc.)
  • method 2: sim.getPositionOnPath(pathHandle,V), with V=-zeroBasedCtrlPointIndex-1 (zeroBasedCtrlPointIndex=0: we are at the beginning of the path (or on the first control point), zeroBasedCtrlPointIndex=1: we are at the second control point of the path, zeroBasedCtrlPointIndex=2: we are at the third control point of the path, etc.)
Cheers

jianye
Posts: 46
Joined: 16 Oct 2019, 13:58

Re: problem about how to use the function sim.getPositionOnPath()

Post by jianye »

hello,

thank you for you prompt reply.

I want to know how can I change the position und orientation of the control point on the path? I want to parameterize the position and orientation of the control point and make a UI to adjust the value of it but I didn't find the function.

thank you in advance.

Jian

Post Reply