Yeah, I know that. But i tried to make physics another way: i made little balls, which are in the line and added physics body to balls. So “line” has physics, but i had little problems with it. If i change line, balls in old line stays in old place and i couldnt remove them. I just got some error.
Here is some code:
local function drawBezierSegment(granularity,r,g,b)
if line then
line:removeSelf()
end
line = display.newLine(bezierSegment[1].x,bezierSegment[1].y,bezierSegment[2].x,bezierSegment[2].y);
for i = 3, granularity, 1 do
line:append( bezierSegment[i].x,bezierSegment[i].y);
a = display.newCircle(bezierSegment[i].x,bezierSegment[i].y ,4)
physics.addBody( a,"static", {bounce = 0.0, friction = 0,radius=4})
end
line:setColor(r,g,b);
line.width=2;
end
But when i tried to remove those balls with a:removeSelf(), i just got error: "attempt to call method removeSelf a nil value
I dont know where problem is. [import]uid: 18445 topic_id: 12802 reply_id: 46947[/import]