I recently upgraded to the latest version of CoppeliaSim and since then simSwitchThread from a plugin does not seem to be working in the same way. When I run the following threaded LUA-script I see the robot moving. Removing sim.switchThread() I no longer see the robot moving. Removing sim.setThreadAutomaticSwitch(false) I again see the robot moving, from automatic thread switching.

Code: Select all

```
local joint = sim.getObjectHandle("joint")
local cylic, limits = sim.getJointInterval(joint)
jointValue = limits[1]
sim.setThreadAutomaticSwitch(false)
for i= 1,1000 do
sim.setJointPosition(joint, jointValue)
jointValue = jointValue + limits[2]/100
if jointValue > limits[1] + limits[2] then
jointValue = limits[1]
end
sim.switchThread()
end
sim.setThreadAutomaticSwitch(true)
```

Code: Select all

```
auto joint = simGetObjectHandle("joint");
simBool cyclic;
simFloat limits[2];
simGetJointInterval(joint, &cyclic, limits);
auto jointValue = limits[0];
sim.setThreadAutomaticSwitch(false)
for (int i = 0; i < 1000; ++i) {
simSetJointPosition(joint, jointValue);
jointValue = jointValue + limits[1] / 100.f;
if (jointValue > limits[0] + limits[1])
jointValue = limits[0];
simSwitchThread();
}
sim.setThreadAutomaticSwitch(true)
```