I have been trying to create a game in pymunk with a 2D terrain using Opennoise. The coordinates of the terrain are:
from opensimplex import OpenSimplex
noise = OpenSimplex()
inputs = np.zeros((100002,2))
for x in range(100000):
inputs[x] = ([x, (noise.noise2d(0.004*x, 0) - 0.125)*100 + 700])
inputs[100000] = ([100000,900])
inputs[100001] = ([0,900])
The y coordinates are shifted by +700 because i use pygame to display everything and the top of the window is at y = 0 and the bottom at y = 800.
I then create a pymunk static body with a polygon shape, and create a pygame shape to display the terrain like this: (pm = pymunk)
self.body = pm.Body(10,100,pm.Body.STATIC)
self.shape = pm.Poly(self.body, inputs)
space.add(self.body, self.shape)
pygame.draw.polygon(surface, color, inputs)
The shape created by pygame, which looks correct, doesnt match up with the shape of the pymunk polygon which indicates that pymunk is not creating the intended shape. So how do i create the the pymunk shape as intended?