I have created 100 cubes in a scenario with names Cube_1, Cube_2, Cube_3 ...... so on ...... Cube_100. Now I want to retrieve object handle for each of these cubes inside a function. My portion of code inside the function where I am trying to calculate contact forces for each box -
for i = 0, 100, 1 do
local force = 0
local SumF = 0
local forceMax = 0
objectsInContact,_,forceDirectionAndAmplitude = sim.getContactInfo(sim.handle_all, sim.getObjectHandle("Box"..i), index)
force = (math.abs(forceDirectionAndAmplitude[1])+math.abs(forceDirectionAndAmplitude[2])+math.abs(forceDirectionAndAmplitude[3]))/10
SumF = SumF + force
print("Force : ".. SumF)
Everytime I call the function, I get the following error -
I created a dummy object "Cube" and associated script with the function. Still get the error. Do I have to make the dummy object parent of all the cubes?