Hi
I have the following boat shape that has an element of force and transition against it to move it from left to right across the screen.
[lua]boat.y = 200
boat.x = -50
baseShape = { -47,-10, 45,-10, 32,25, -35,25 }
funnelShape = { -30,-25, -15,-25, -15,5, -30,5 }
– Create static deck so that boxes can sit on
local deck = display.newRect( -50, 200, 50, 5 )
deck:setFillColor( 0, 0, 0, 0) – make invisible
physics.addBody( deck, “static”)
–physics.addBody(boat, “dynamic”, {density=0.5, friction=0.5, bounce=0})
physics.addBody(boat, “dynamic”, {density=0.5, friction=0.5, bounce=0, shape=funnelShape},
{density=5, friction=0.5, bounce=0, shape=baseShape})
myJoint = physics.newJoint( “weld”, boat, deck, -50,200 )
– Apply movement
transition.to(boat, {time=5000, x=220, transition = easing.linear})
transition.to(deck, {time=5000, x=220, transition = easing.linear})[/lua]
Because the boat is dynamic to interact with its environment when trying to balance objects on it they pass through. Now I could be showing my Box2D / Corona naivety here but I though I would apply a static “deck” body and use a weld joint so that the items would sit happily on the deck.
However, for the deck body to keep up with the boat I am having to apply the same transition but they move at different speeds.
I’ve got a feeling I am going about this the wrong way. I kind of want to instantiate the boat with a mix of physics types dependent on the shape defined but I don’t think this is possible.
Can you help please
[import]uid: 103970 topic_id: 18586 reply_id: 318586[/import]