Hello everyone,
What I am doing is, I am using sensors to detect collisions and checking whether the collision has took place in touch began phase if yes then the object should create a weld joint with a stationary object.
The error i have got is posted below:
"ERROR: C:\Users\Swanand\Documents\Corona Projects\circular2\main.lua:77: physics.newJoint() cannot be called when the world is locked and in the middle of number crunching, such as during a collision event"
I haven’t put the whole code because its quite large enough I have just put the part in which the above error has arrived.
The code is given below please have a look over it and every suggestion is welcome:
function revolve(re) newJoint= physics.newJoint( "weld",re,ball,re.x,re.y) end local function collide(event) if event.phase == "began" then if event.object1.name=="rect" and event.object2.name=="ball" then print("true") for \_,re in ipairs(rects1) do revolve(re) end end end end function tap( event ) if ( "began" == event.phase ) then Runtime:addEventListener( "collision", collide ) elseif("ended"==event.phase) then display.remove(myJoint) end end bg:addEventListener("touch",tap)
Thanks and Regards,
Swanand Thakur.