Dynamic sticks to static

In this fairly simple code sample, moving the dynamic circle around with the touch causes it to stick to the static rectangle. Can anyone explain why or perhaps offer a solution which otherwise leaves the physical behaviour unchanged, please?

main.lua:
[lua]require(“physics”)
physics.start()
physics.setGravity(0,0)
physics.setDrawMode(“hybrid”)

r = display.newRect( 100, 100, 100, 100 )
physics.addBody( r, “static”, {friction=0,density=1,bounce=0} )

a = display.newCircle( display.contentWidth/2, display.contentHeight/2, 25 )
physics.addBody( a, “dynamic”, {friction=0,density=1,bounce=0,radius=25,isSensor=true} )
a.isFixedRotation = true

function a:touch(e)
if (not a.hasFocus and e.phase == “began”) then
e.target.hasFocus = true
display.getCurrentStage():setFocus(e.target)
e.target.touchjoint = physics.newJoint(“touch”,e.target,e.x,e.y)
e.target.touchjoint.dampingRatio = 0
e.target.touchjoint.frequency = 10000000000
e.target.touchjoint.maxForce = 10000000000
e.target.isSensor = false
–timer.performWithDelay(1,function() e.target.bodyType = “kinetic” end, 1)
return true
elseif (a.hasFocus) then
if (e.phase == “moved”) then
e.target.touchjoint:setTarget(e.x,e.y)
else
display.getCurrentStage():setFocus(nil)
e.target.touchjoint:removeSelf()
e.target.hasFocus = false
e.target.isSensor = true
–timer.performWithDelay(1,function() e.target.bodyType = “static” end, 1)
timer.performWithDelay(1,function() e.target:setLinearVelocity( 0, 0 ) end, 1)
end
return true
end
return false
end
a:addEventListener(“touch”,a)[/lua] [import]uid: 8271 topic_id: 32702 reply_id: 332702[/import]

I don’t understand the problem/see a sticking issue. Can you elaborate on how it actually sticks? [import]uid: 147305 topic_id: 32702 reply_id: 129992[/import]

I don’t understand the problem/see a sticking issue. Can you elaborate on how it actually sticks? [import]uid: 147305 topic_id: 32702 reply_id: 129992[/import]

This is a video of my Windows simulator running build 947:

http://screencast.com/t/VMqrQmcz

The best example is around 10 seconds. [import]uid: 8271 topic_id: 32702 reply_id: 130002[/import]

This is a video of my Windows simulator running build 947:

http://screencast.com/t/VMqrQmcz

The best example is around 10 seconds. [import]uid: 8271 topic_id: 32702 reply_id: 130002[/import]

And now I get this:

[lua]2012-11-07 06:46:37.277 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:38.134 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:38.597 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:39.190 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:39.818 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:40.477 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:41.071 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
Corona Simulator(3755,0x7fff7f303180) malloc: *** error for object 0x11103a7e8: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
/Applications/CoronaSDK/Corona Terminal: line 9: 3755 Abort trap: 6 “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*
logout[/lua] [import]uid: 8271 topic_id: 32702 reply_id: 130115[/import]

And now I get this:

[lua]2012-11-07 06:46:37.277 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:38.134 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:38.597 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:39.190 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:39.818 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:40.477 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
2012-11-07 06:46:41.071 Corona Simulator[3755:707] Runtime error
?:0: attempt to call a table value
stack traceback:
[C]: ?
?: in function <?:229>
Corona Simulator(3755,0x7fff7f303180) malloc: *** error for object 0x11103a7e8: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
/Applications/CoronaSDK/Corona Terminal: line 9: 3755 Abort trap: 6 “$path/Corona Simulator.app/Contents/MacOS/Corona Simulator” $*
logout[/lua] [import]uid: 8271 topic_id: 32702 reply_id: 130115[/import]

Ok, well, changing the extreme values to something more reasonable helped…

[lua]e.target.touchjoint.frequency = 1000
e.target.touchjoint.maxForce = 1000[/lua] [import]uid: 8271 topic_id: 32702 reply_id: 130148[/import]

Ok, well, changing the extreme values to something more reasonable helped…

[lua]e.target.touchjoint.frequency = 1000
e.target.touchjoint.maxForce = 1000[/lua] [import]uid: 8271 topic_id: 32702 reply_id: 130148[/import]