I'm having a problem with polygon Edges as shapes. This code is supposed to make me a sphere of 20 sides (think of a goldfish bowl), but it is not stopping the contents of my bowl from escaping. I've obviously missed something but I'm not sure what it is
I've used a2Line to plot the points and I have definitely craeted my bowl shape exactly where I want it.
dim arrpoint(20,3)
mx = screen width() / 2: my = screen height() / 2
iBody = b2createBody(world, b2BodyType_Static(),mx,my,0)
r = (screen height() * 0.95) / 2
for n = 0 to 20
arrpoint(n,1) = mx + (r * sin(n*18))
arrpoint(n,2) = my + (r * cos(n*18))
debugPrint("Point " + str$(n) + " = " + str$(arrpoint(n,1)) + "," + str$(arrpoint(n,2)))
next n
for n = 1 to 20
arrpoint(n,3) = b2createPolygonShapeAsEdge(arrpoint(n-1,1),arrpoint(n-1,2), arrpoint(n,1),arrpoint(n,2))
null = b2CreateFixture(iBody,arrpoint(n,3),1)
next n
These are the points it plots:
Point 0 = 720,877
Point 1 = 851,856
Point 2 = 970,795
Point 3 = 1065,700
Point 4 = 1126,581
Point 5 = 1147,449
Point 6 = 1126,318
Point 7 = 1065,199
Point 8 = 970,104
Point 9 = 851,43
Point 10 = 719,23
Point 11 = 588,43
Point 12 = 469,104
Point 13 = 374,199
Point 14 = 313,318
Point 15 = 293,450
Point 16 = 313,581
Point 17 = 374,700
Point 18 = 469,795
Point 19 = 588,856
Point 20 = 720,877