need help with some physics

Hi guys,

I have been racking my brain on this issue… and can’t seem to fix it… it might be something small that I am just missing…

basically what I need is a thin rectangle that is suspended from the celling to be able to move when the user touches the screen (I have done this… easy) but what I also need is a square to be attached to the bottom of the rectangle. When the physics kicks in they move differently… I need the square to be attached to the rectangle so that it just moved with the rectangle…

I tried using the weld join but no good… I think its to do with my reference point in the rectangle. but if I change that then the two items are stuck together but I can’t swing properly from the celling…

code below

[code]
local physics = require “physics”
physics.start( true )
physics.setDrawMode(“normal”) – set to “debug” or “hybrid” to see collision boundaries
physics.setDrawMode(“hybrid”)
physics.setGravity( 0, 9.8 ) --> 0, 9.8 = Earth-like gravity

local cel = display.newRect(0, 0, display.contentWidth, 100)
physics.addBody(cel, “static” )

local line = display.newRect(200, 100, 10, 600)
local square = display.newRect(line.x - 50 , line.y+200 , 100, 100)

function movement(event)

line:applyLinearImpulse( 1, 0, line.x, line.y )

end

physics.addBody(line, “dynamic”, {shape=unit} )
physics.addBody(square, “dynamic” )
line:setReferencePoint( display.TopCenterReferencePoint )
local joint = physics.newJoint( “pivot”, cel, line, line.x, line.y - 20 )
local joint1 = physics.newJoint( “weld”, square, line, 200, 600 )

Runtime:addEventListener( “touch”, movement )
[/code] [import]uid: 67619 topic_id: 19401 reply_id: 319401[/import]