How do you add a jointed physics body to a system and apply force to it?

For example, a ragdoll?

Or even simpler, an animal with a head and a tail?

doll.lua:

function new()  
  
local obj = display.newGroup();  
local head = display.newImageRect( "images/head.png", 12, 9 );  
local tail = display.newImageRect( "images/tail.png", 5, 4 );  
tail.x = -7;  
  
obj:insert(head);  
  
obj:insert(tail);  
  
function obj:throw()  
  
--this works   
--physics.addBody( obj, {density = 1, friction = 1.0, bounce = 0.3})   
  
--this doesn't work. the object just falls straight down through everything:  
physics.addBody( head, {density = 1, friction = 1.0, bounce = 0.3} )  
physics.addBody( tail, {density = 1, friction = 1.0, bounce = 0.3} )  
theJoint = physics.newJoint( "pivot", head, tail, 0,0 )  
theJoint.isLimitEnabled = true;  
theJoint:setRotationLimits( -30, 30 );  
  
--how would you then apply force to the jointed object?  
  
end  
  
return obj;  
end  

called like this:

local d = Doll.new() d:throw(); [import]uid: 52127 topic_id: 10952 reply_id: 310952[/import]