From: nicholas s. <nic...@gm...> - 2008-01-27 16:46:30
|
you have to attach a Transform Geom to the body. Then the transform encapsulates other geoms applied to it. So for example if I wanted to have a barbell as single object, I would create a body, and then assign it a Transform geom, then I would create the two spheres, offset them and then assign them to the Transform geom so that they are locked into place, and then do likewise for the connecting bar. You have the option of assigning a mass based on some other shape, or using the offset geoms as to position the masses as well. But when I did the latter I ran into problems with PyOde in not being able to rotate masses and lock them to the Transform as I did with the geoms. The function below only shows how to assign one geom to a transform. I can't recall if you create a Transform for every geom, or one encapsulates many. best, nick def createGeomSphere(space,body,r,pos): trans = ode.GeomTransform(space) trans.setBody(body) geom = ode.GeomSphere() geom.setRadius(r) trans.setGeom(geom) trans.setInfo(0) geom.setPosition(pos) trans.geom = geom return trans On Jan 26, 2008 7:14 PM, tim rau <bla...@ya...> wrote: > Traceback (most recent call last): > File "C:\Documents and Settings\Owner\My > Documents\NIm's code\sandbox\sandbox.py", line 258, in > <module> > input(pygame.event.get()) > File "C:\Documents and Settings\Owner\My > Documents\NIm's code\sandbox\sandbox.py", line 166, in > input > player.clampDeploy() > File "C:\Documents and Settings\Owner\My > Documents\NIm's code\sandbox\sandbox.py", line 133, in > clampDeploy > self.clamp.setBody(self.body) > File "geomobject.pyx", line 107, in > ode.GeomObject.setBody > TypeError: exceptions must be strings, classes, or > instances, not type > > > Yahoo wont let me keep my exception lines the way > python gave them to me. grumble. Anyway, I'm calling > geom.setBody(self.body), and it seems to be throwing > an exception, but python doesn't like the flavor of > the exception. I've already done a bit of searching on > this one. the geom in question is a ray, and self.body > is really a valid ode.Body, and I know cause I checked > it with pdb. I've looked in the docs, and an ode.Body > seems to be exactly what the function wants. > > I already have a geom attached to this body, but I > want another one as a probe for the magnetic grapple. > I've heard that a body can have any number of geoms, > but I couldn't find it in the docs, so I need this > verified. Also, how do I set the position of the geom > relative to the body? > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2008. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Pyode-user mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyode-user > |