Physics joint problem?

Hey guys, I’ve been working on this little project for ages now, not that it’s complicated or anything, it’s just I’ve been trying to figure out workarounds for the problem I’m having.

Basically my code is as such:

local gameUI = require("gameUI")  
local physics = require("physics")  
physics.start()  
display.setStatusBar( display.HiddenStatusBar )  
  
local bkg = display.newImage( "bkg\_cor.png" )  
  
local grass = display.newImage("grass.png")  
grass.x = 160; grass.y = 430  
  
local grass2 = display.newImage("grass2.png")  
grass2.x = 160; grass2.y = 440  
  
physics.addBody( grass, "static", { friction=0.5, bounce=0.3 } )  
physics.setDrawMode("hybrid")  
  
local function dragBody ( event )  
 gameUI.dragBody( event, { maxForce=400000, frequency=5, dampingRatio=0.2 } )  
end  
  
function newCrate()   
 rand = math.random( 100 )  
  
 if (rand \< 60) then  
 j = display.newImage("crateB.png");  
 j.x = 60 + math.random( 160 )  
 j.y = -100  
 physics.addBody( j, { density=0.9, friction=0.3, bounce=0.3} )  
 j.rotation = math.random(1, 360)  
 j:addEventListener( "touch", dragBody )  
  
 elseif (rand \< 80) then  
 j = display.newImage("crateB.png");  
 j.x = 60 + math.random( 160 )  
 j.y = -100  
 j.rotation = math.random(1, 360)  
 j:addEventListener( "touch", dragBody )  
 physics.addBody( j, { density=1.4, friction=0.3, bounce=0.2} )  
  
 else  
 j = display.newImage("crateB.png");  
 j.x = 60 + math.random( 160 )  
 j.y = -100  
 j.rotation = math.random(1, 360)  
 j:addEventListener( "touch", dragBody )  
 physics.addBody( j, { density=0.3, friction=0.2, bounce=0.5} )  
  
 end   
end  
  
local dropCrates = timer.performWithDelay( 500, newCrate, 1 )  

It’s all fine, works perfect in the simulator, but when I compile it and run it on my Android, basically whenever you move your finger while you’re touching the crate that’s there the temporary joint that gameUI creates stops directly at the edge of my crate image. If you keep your finger held down on the screen and move back to the crate it starts following your finger around again, but if you let go, it pins the edge of the joint to the screen and the object freezes in mid-air.

I know there’s bugs in the SDK for Android at the moment, but is there any work around for this that you know of?

I tried basically making the image much bigger with a big transparent border and setting a square shape into the image to capture basically just the centre crate in hope that it would still realise that you’re touching the image and not lock the joint. It does, brilliant, but when you have more than one of the crates on screen it tries to create a joint for both of them where you touch as the touch area affected includes the transparent border! ARGH!

So anyways, any ideas would really be appreciated,

Thanks guys,
Steve [import]uid: 31920 topic_id: 5855 reply_id: 305855[/import]

I have the same problem when using gameUI.dragBody. It works fine in a Simulator but on my Nexus S this also happens:

“It’s all fine, works perfect in the simulator, but when I compile it and run it on my Android, basically whenever you move your finger while you’re touching the crate that’s there the temporary joint that gameUI creates stops directly at the edge of my crate image. If you keep your finger held down on the screen and move back to the crate it starts following your finger around again, but if you let go, it pins the edge of the joint to the screen and the object freezes in mid-air.”

Any solutions ? [import]uid: 46825 topic_id: 5855 reply_id: 29078[/import]

It works in the new build
.317

BR [import]uid: 9592 topic_id: 5855 reply_id: 29124[/import]

Thanks, I dont have acess to the daily builds yet, but I’ll be subscribing soon! :slight_smile: [import]uid: 46825 topic_id: 5855 reply_id: 29245[/import]