Page 1 of 1
an instruction for sim.followPath
Posted: 01 Dec 2020, 21:12
by quangabcd
Hi,
can any body provide an example/instruction how to use sim.followPath (
https://www.coppeliarobotics.com/helpFi ... owPath.htm)?
i could not find any path following using this approach
Re: an instruction for sim.followPath
Posted: 04 Dec 2020, 10:37
by coppelia
Hello,
sim.followPath is deprecated and should not be used anymore. If possible, also try to avoid path objects, since they are not that flexible and there will be a better option in next release (i.e. V4.2.0). But for the time being, do something like:
Code: Select all
-- init:
path=sim.getObjectHandle('myPath')
pathLength=sim.getPathLength(path)
-- e.g. place an object at 0.1 meter from the start of the path:
local dist=0.1
local relDist=dist/pathLength
local pos=sim.getPositionOnPath(path,relDist)
local euler=sim.getOrientationOnPath(path,relDist)
sim.setObjectPosition(myObjectHandle,pos)
sim.setObjectOrientation(myObjectHandle,euler)
Cheers
Re: an instruction for sim.followPath
Posted: 06 Dec 2020, 11:33
by quangabcd
Thanks,
the approach with set-get position works
you may need to update the instruction to avoid confusing people ;)
Re: an instruction for sim.followPath
Posted: 27 May 2022, 20:57
by Hrithik Verma
Hello
How to make a object follow path in coppeliasim 4.2.0 (rev5) because the above code is not working and sim.followpath() is already deprecated.
I also tried
https://www.coppeliarobotics.com/helpFiles/en/paths.htm follow path method describe in it but that also not working.
I think this particular part should be clearly describe in a post because lots of version having different methods to follow path and people will get lot of confusion.
Thanks in advance
Re: an instruction for sim.followPath
Posted: 30 May 2022, 06:59
by coppelia
Always make sure to use the newest CoppeliaSim version. In CoppeliaSim V4.2 and V4.3, you'll find a demo scene
scenes/movingAlongAPath.ttt: there you will find many different examples on how to have an object follow a
path.
Cheers