Calling newJoint on a DisplayObject with a “kinematic” physics body causes the following:
Assertion failed: (d + step.dt * k > 1.19209290e-7F), function InitVelocityConstraints
Then crashes the sim. I thought a workaround may be to set the body to “dynamic” in the touch->began phase. This works, but if you set it back to “kinematic” and touch->ended the same assertion and crash follows.
This is unexpected as the docs say draggable objects should be kinematic, even temporarily while dragging. So doing this according to the docs also causes the crash.
If it’s just draggable button, setting it to static, switching to dynamic in “began” then back to static in “ended” works, but of course it won’t interact with other objects unless you’re dragging it.
Handler dragBody is same as in Corona sample code and docs;
local ball = display.newCircle(100, 100, 30)
ball:setFillColor(255, 0, 0)
physics.addBody(ball)
ball.bodyType="kinematic" -- static and dynamic OK
ball:addEventListener( "touch", dragBody )
Crash happens here in the phase==“began” block of dragBody:
body.tempJoint = physics.newJoint( "touch", body, event.x, event.y )
if you firstly set it to dynamic you can drag it OK. But if you set it back to kinematic:
elseif "ended" == phase or "cancelled" == phase then
body.bodyType = "kinematic" -- OK so far
The handler exits OK but the sim crashes before anything else is displayed.
If I’m doing this the wrong way hopefully someone can correct me. [import]uid: 3953 topic_id: 1899 reply_id: 301899[/import]