i want to make a pancake like this (https://www.youtube.com/watch?v=tk8pYBqUjZM)
i trying to make it. I’m able to make rubbery like the pancake
i asked the developer. & he replied me this “The pancake is made of 6 elements in the corona(box2d) that are joined with pivot joints, limited from something like -15 to +15 degrees”
so i did the same took a pancake cut in six pieces and try to make it .but the problem is when my pancake get to edge , pivots are visible, the pancake is not curved like i the game. i used these parameters (i’m using: -friction, bounce, density & setLimitRotation) anything else? plz plz plz help me. i’m stuck at this from 3 days
my code is below :
local centerX = display.contentCenterX
local centerY = display.contentCenterY
local _W = display.contentWidth
local _H = display.contentHeight
local physics = require(“physics”)
physics.start()
physics.setGravity(0,9.8)
display.setStatusBar( display.HiddenStatusBar )
– The final “true” parameter overrides Corona’s auto-scaling of large images
local background = display.newImage( “jungle_bkg.png”, centerX, centerY, true )
–pancake part1
local p1 = display.newImageRect( “p1.png”,22,15 )
p1.x = 155; p1.y = 150;
physics.addBody( p1, “dynamic”, { friction=0.5,density=0.6 } )
–pancake last part (part6)
local p6 = display.newImageRect( “p6.png”,22,15)
p6.x = 215; p6.y = 150;
physics.addBody( p6, “dynamic”, { friction=0.5 ,density=0.6} )
–platform
local platform =display.newImageRect(“pancake.png”,70,20)
platform.x =205;platform.y =300
physics.addBody( platform, “static”, { friction=1,bounce =0 } )
local board = {}
local joint = {}
board[1] = display.newImageRect( “p2.png” ,22,15)
board[1].x = 165;board[1].y = 150
physics.addBody( board[1], { density=0.5 ,friction=0.3 })
joint[1] = physics.newJoint( “pivot”, p1, board[1], 165, 150 )
joint[1].isLimitEnabled = true
joint[1]:setRotationLimits( -15, 15)
----------------------------------------------------
--joint2
board[2] = display.newImageRect( “p3.png” ,22,15)
board[2].x = 175
board[2].y = 150
physics.addBody( board[2], { density=0.5, friction=0.3 } )
joint[2] = physics.newJoint( “pivot”, board[1], board[2], 175, 150 )
joint[2].isLimitEnabled = true
joint[2]:setRotationLimits( -15, 15)
----------------------------------------------------
--joint3
board[3] = display.newImageRect( “p3.png” ,22,15)
board[3].x = 185
board[3].y = 150
physics.addBody( board[3], { density=0.5, friction=0.3 } )
joint[3] = physics.newJoint( “pivot”, board[2], board[3], 185, 150 )
joint[3].isLimitEnabled = true
joint[3]:setRotationLimits( -15, 15)
--joint4----------------------------------------------------------------
board[4] = display.newImageRect( “p3.png” ,20,15)
board[4].x = 195
board[4].y = 150
physics.addBody( board[4], { density=0.5, friction=0.3 } )
joint[4] = physics.newJoint( “pivot”,board[3], board[4], 195, 150 )
joint[4].isLimitEnabled = true
joint[4]:setRotationLimits( -15, 15)
--joint5-----------------------------------------------------------------
board[5] = display.newImageRect( “p5.png” ,22,15)
board[5].x = 205
board[5].y = 150
physics.addBody( board[5], { density=0.5, friction=0.3} )
joint[5] = physics.newJoint( “pivot”, board[4], board[5], 205, 150 )
joint[5].isLimitEnabled = true
joint[5]:setRotationLimits( -15, 15)
--joint 6----------------------------last joint
joint[6] = physics.newJoint( “pivot”, board[5], p6, 210, 150 )
joint[6].isLimitEnabled = true
joint[6]:setRotationLimits( -15, 15)
local function pushPancake()
p1:applyLinearImpulse(0, -8, p1.x-10, p1.y )
end
p1:addEventListener( “tap”, pushPancake )