Walter,
I would like to simulate a bouncing ball.
I simply create a physical object which consists of a ball and some joints.
In enter frame I would assign positions of the vertices to appropriate elements of my contraption, which would allow to simulate the bounce effect.
local physics = require("physics") local verticles = {} local x, y = 300, 300 local radius = 100 local angle = 40 local circles = {} physics.start() local inner = display.newCircle(x, y, radius - 50) physics.addBody(inner) for i = 1, 360 / angle do local radians = i \* angle \* math.pi / 180 local xa = x + radius \* math.cos(radians) local ya = y + radius \* math.sin(radians) table.insert(verticles, xa) table.insert(verticles, ya) local c = display.newCircle(xa, ya, 1) table.insert(circles, c) physics.addBody(c) physics.newJoint("distance", inner, c, inner.x, inner.y, c.x, c.y) if i \> 1 then physics.newJoint("distance", circles[i - 1], c, circles[i - 1].x, circles[i - 1].y, c.x, c.y) if i == 9 then physics.newJoint("distance", circles[i], circles[1], circles[i].x, circles[i].y, circles[1].x, circles[1].y) end end end local poly = display.newPolygon(x, y, verticles) local line = display.newRect(512, 700, 1024, 10) physics.setDrawMode("hybrid") physics.addBody(line) line.bodyType = "static" poly.x = 100 poly.y = 100
So I would like to map it to the polygon you see there, and put a texture on the polygon, like a beach ball for example 