From: Matthias B. <ba...@ir...> - 2006-01-08 21:44:23
|
Simon Wittber wrote: > I'm attempting to use PyODE for a 2D platform game. > > The below code is not doing what I expect. > > self.space = space = ode.Space() > self.back = ode.GeomPlane(space, (0,0,1), 1) > self.front = ode.GeomPlane(space, (0,0,-1),-1) I believe the distance of the second plane should be +1 (as you have already inverted the normal), otherwise both planes coincide and the simulation most certainly goes haywire. Apart from that, I'm not sure if your technique is a good idea at all. I wouldn't be surprised if the simulation does weird things sooner or later because ODE smashes the objects from one plane to the other and accumulates high velocities in your undesired third dimension. You may probably want to set the Z values of all positions and velocities to zero after each simulation step (in which case the above planes might even be superfluous). Of course, the best solution would be to switch to a true 2D simulator as this one could be much more efficient than a full 3D simulator projected back to 2D. - Matthias - |