Typically: "How do I... ", "How can I... " questions
cpscps
Posts: 3
Joined: 09 Sep 2020, 11:37

I am trying to make two quadricopters follow two different paths using the following code in Quadricopter_target file

Code: Select all

target=sim.getObjectAssociatedWithScript(sim.handle_self)
path=sim.getObjectHandle('Path1')

for i=1, 1 do
sim.followPath(target,path,1,0,0.2,0.5)
end

for the first quadricopter and the same code with 'Path2' instead of 'Path1' for the second one.

However, only the first quadricopter follows his path while the second one just stay on site. I guess that it is a consecuence of the #0 suffix that appears in the name of the second quadricopter. I tried to modify the code of the child script while renaming the quadricopter#0 files but, despite of the quadricopter#0 starts moving, it doesn't follow its path.

coppelia
Posts: 8368
Joined: 14 Dec 2012, 00:25

Normally, you do not add a #n suffix to the object names, when you access them with sim.getObjectHandle: this ways, if you copy and paste your model/models, then the copy is automatically correctly accessing not the original objects, but the copies.