hii,i am studying the concept of spawning.now i can spawn simple object like simple shapes(circle,squre,image),but i wanted to spawn physics objects joined by physics joints .so i write a program
but didnt work …my problem is i dont know the real concept of spawning jointed objects.
here is part my code …
local physics=require("physics") physics.start() local t={} local ball1=display.newCircle(0,0,20) physics.addBody(ball1,"dynamic") ball1.gravityScale=o ball1:setFillColor(0.20,0.20,0.20); ball1.x=200+display.screenOriginX ball1.y=300+display.screenOriginY table.insert(t,ball1) ball2=display.newCircle(0,0,20) physics.addBody(ball2,"dynamic") ball2.gravityScale=o ball2:setFillColor(0.0,0.20,0.20); ball2.x=220+display.screenOriginX ball2.y=300+display.screenOriginY ball2.isSensor=true table.insert(t,ball2) local pivotJoint = physics.newJoint( "pivot", ball1,ball2, ball1.x, ball1.y ) table.insert(t,pivotJoint) print(#t) local b={} b[#b+1]={t} print(#b) local enemy=b[1] enemy:setLinearVelocity(-15,0)