BubbleSpinner like game in Corona

What kind of joints (box 2d) does the Bubble Spinner use? 

26112146_10160056980170227_1321626562203

I’ve experimented with pivot and weld and distance joints in various combinations.

Here’s a link to play this game in a browser - http://www.deadwhale.com/play.php?game=774

The center joint is the most critical one.

Please help. 

Hello,

on the tutorial for the weld-joint, they says that it’s not rigid, there are slighty move because math calculation.

Use better an entire multi-body with shape, it’s don’t oscillate, and you can rotate the whole body easily.

Use also a preCollision to made the part-element “sensor” with the contact isEnabled value.

 local ball=display.newGroup() local shapes = {} local numPart = 1 local function add(i,j) local r1=display.newRect( ball, 50\*i, 50\*j, 40, 40) // or other pictures shapes[1+#shapes]= {shape= {-20+50\*i,-20+50\*j, 20+50\*i,-20+50\*j, 20+50\*i,20+50\*j, -20+50\*i,20+50\*j} } r1.id=numPart numPart=numPart+1 return r1 end for i=-2,2 do for j=-2,2 do if i~=0 or j~=0 then add(i,j) end // avoid the center, just for esthetic ; you can put here a png end end physics.addBody( ball,"dynamic", unpack(shapes) )

Thanks for your prompt response yvandotet

However, the shapes in Bubble Spinner are hexagonal in nature. So it’s a hexagonal grid. 

I also want the momentum to be transferred to the central body on collision(which rotates along the central axis). What do you suggest in that regard? The center of this physics body needs to be pivoted to the center. I’m guessing that you havent taken into consideration the rotation of the cental setup. 

For the rotation, just use a pivot joint linked to a static object, and play also with the density params

ball.nj=physics.newJoint( "pivot", ball, wall, ball.x, ball.y)

for the shapes, adapt by using smart couple of (i,j) on the add function.

for exemple : 

 for j=-3,3 do local jp = math.abs( j ) for i=-(4-jp),4-jp do add(i,j) end end

Yvan

Hello,

on the tutorial for the weld-joint, they says that it’s not rigid, there are slighty move because math calculation.

Use better an entire multi-body with shape, it’s don’t oscillate, and you can rotate the whole body easily.

Use also a preCollision to made the part-element “sensor” with the contact isEnabled value.

 local ball=display.newGroup() local shapes = {} local numPart = 1 local function add(i,j) local r1=display.newRect( ball, 50\*i, 50\*j, 40, 40) // or other pictures shapes[1+#shapes]= {shape= {-20+50\*i,-20+50\*j, 20+50\*i,-20+50\*j, 20+50\*i,20+50\*j, -20+50\*i,20+50\*j} } r1.id=numPart numPart=numPart+1 return r1 end for i=-2,2 do for j=-2,2 do if i~=0 or j~=0 then add(i,j) end // avoid the center, just for esthetic ; you can put here a png end end physics.addBody( ball,"dynamic", unpack(shapes) )

Thanks for your prompt response yvandotet

However, the shapes in Bubble Spinner are hexagonal in nature. So it’s a hexagonal grid. 

I also want the momentum to be transferred to the central body on collision(which rotates along the central axis). What do you suggest in that regard? The center of this physics body needs to be pivoted to the center. I’m guessing that you havent taken into consideration the rotation of the cental setup. 

For the rotation, just use a pivot joint linked to a static object, and play also with the density params

ball.nj=physics.newJoint( "pivot", ball, wall, ball.x, ball.y)

for the shapes, adapt by using smart couple of (i,j) on the add function.

for exemple : 

 for j=-3,3 do local jp = math.abs( j ) for i=-(4-jp),4-jp do add(i,j) end end

Yvan