From: Simon W. <sim...@gm...> - 2006-01-07 15:02:16
|
I'm attempting to use PyODE for a 2D platform game. The below code is not doing what I expect. self.space =3D space =3D ode.Space() self.back =3D ode.GeomPlane(space, (0,0,1), 1) self.front =3D ode.GeomPlane(space, (0,0,-1),-1) What I want to do is sandwich my world between two vertical infinite planes. Am I going about this the right way? -Sw. |
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 - |
From: Simon W. <sim...@gm...> - 2006-01-09 01:14:06
|
On 1/9/06, Matthias Baas <ba...@ir...> wrote: > 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). Hmm I might try this. > 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. Thanks for the feedback. I agree, however, I cannot find a 2D simulator. Do you know of any such thing? Before I started using ODE, I started coding a 2D simulator using Numeric. However, my knowledge of physics is not enough to finish the job. -Sw. |
From: Matthias B. <ba...@ir...> - 2006-01-09 21:26:17
|
Simon Wittber wrote: >>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. > > Thanks for the feedback. I agree, however, I cannot find a 2D > simulator. Do you know of any such thing? No, sorry. > Before I started using ODE, I started coding a 2D simulator using > Numeric. However, my knowledge of physics is not enough to finish the > job. Well, as long as ODE does the job without being the bottleneck in your game there's probably no need to write a new simulator anyway. By the way, don't forget to post a message when you've finished the game... ;) - Matthias - |
From: Chris M. <ch...@mc...> - 2006-01-09 01:53:43
|
On Sat, Jan 07, 2006 at 11:02:12PM +0800, 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) > > What I want to do is sandwich my world between two vertical infinite > planes. Am I going about this the right way? Hi Simon, I beleive it's possible to use ODE as a 2d engine just by keeping all your z values at zero. Check out tutorial2.py in the examples that come with PyODE. That is, make everything in your world have no thickness and no z values at all. Best, Chris. ------------------- ch...@mc... http://mccormick.cx |
From: Thomas P. <tho...@fr...> - 2006-01-09 21:41:07
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> <title></title> </head> <body bgcolor="#ffffff" text="#000000"> <br> <blockquote cite="mid...@mc..." type="cite"> <blockquote type="cite"> <pre wrap="">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) What I want to do is sandwich my world between two vertical infinite planes. Am I going about this the right way? </pre> </blockquote> <pre wrap=""><!----> Hi Simon, I beleive it's possible to use ODE as a 2d engine just by keeping all your z values at zero. Check out tutorial2.py in the examples that come with PyODE. That is, make everything in your world have no thickness and no z values at all. Best, Chris. </pre> </blockquote> Hello,<br> <br> A patch for a Plane2D joint is available on the Ode mailing list archive. With a little hack on PyOde, maybe this new joint type could be available for Python.<br> <br> Here is a link to this patch:<br> <br> <a class="moz-txt-link-freetext" href="http://q12.org/pipermail/ode/2003-November/010325.html">http://q12.org/pipermail/ode/2003-November/010325.html</a><br> <br> Thomas<br> </body> </html> |