I am making a game in Corona sdk where different balls bounce and stick to each other with a weld joint. When I reset the gameplay, all joints are destroyed, then all the balls are repositioned. Here is some of my code:
--stickJoints and balls are tables that contain all the weld joints and ball objects
resetTotal = function()
for i=1,#stickJoints do
stickJoints[i]:removeSelf()
stickJoints[i]=nil
end
for i=1,20 do
--this resets all balls and sets linear and angular velocity to 0
resetP(balls[i],1000+(i-1)*400,5000,0)
end
end
The problem is that as soon as I tap the reset button, the balls that were connected temporarily interact with each other. Any thoughts are helpful. Thanks!