From: Chris B. <chr...@gm...> - 2005-11-08 10:15:58
|
On 07/11/05, Matthias <Sta...@gm...> wrote: > kx, ky, kz =3D kugel.getPosition() > print kx, ky, kz > pygame.draw.line(srf, (0,0,0), coord(2, 3.8), coord(kx, k= y), 3) > > pygame.draw.rect(srf, (0,100,50), (coord(kx, ky), coord(k= x + 0.1, ky - > 0.1)), 0) from http://www.pygame.org/docs/ref/rect.html#pygame.Rect we find the definition of Rect: pygame.Rect((left, top), (width, height)): return Rect But you used absolute coordinates instead of (width,height) - your rectangle size is shrinking as kx and ky approach the origin! This works better: pygame.draw.rect(srf, (0,100,50), (coord(kx, ky), coord(0.1, 0.1)), 0) Now your next problem is that the joint with the ode.environment doesn't seem to be working. The body is always moving towards the origin. Even if you set the gravity to (0,0,0) it does this. This indicates a prolem with the joint - since the only force in your simulation is generated by ode trying to correct the errors in this joint. The problem is command order, you need to attach the joint before setting the anchor: bj.attach(kugel, ode.environment) bj.setAnchor( (2, 3.8, 0) ) That should fix your problems. Chris |