Object handle error
Posted: 26 Mar 2020, 03:11
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 -
Everytime I call the function, I get the following error -
Code: Select all
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)
Can you help please?Object does not exist. (sim.getObjectHandle)