make ode.GeomObjects visible?

ok, i’m a complete Panda noob and i’m doing some experiments with with pyODE. If i understood well, i can’t define collisions in the egg files if i want to use pyODE. So i have to to put seperatly the model and the ode.GeomObjects in the code to have some collisions occur.
That’s what i have done and it seems to work. My Problem is how to position those GeomObjects.
I have a static box, and i’m trying to put geomBox on each side of the Box to put up the collisions for a ball (which isn’t static) so the ball can’t get out of this box. but how do I position those geomObjects exactly on the sides of the box? Isn’t there a way to make those geomObjects visible, so i can actually see if i positioned them well?

here a screenshot: firstblood.de/test.JPG
and yes, i’m using the pyODE example of miel (discourse.panda3d.org/viewtopic.php?t=1485)

thx for your help.
ISOmorph

Have you tried my code (in that thread too) ?
This creates 4 static boxes surrounding an internal space :

boxes=render.attachNewNode('')
boxes.setH(30)

obj = loader.loadModelCopy('misc/rgbCube')
obj.reparentTo(boxes)
obj.setPos(-2,0,0)
obj.setScale(1,4,1)
self.simObjects.append( ODEbox( world=self.ode_WORLD, space=self.ode_SPACE,
                                realObj=obj, density=0, friction=5000) )

obj = loader.loadModelCopy('misc/rgbCube')
obj.reparentTo(boxes)
obj.setPos(2,0,0)
obj.setScale(1,4,1)
self.simObjects.append( ODEbox( world=self.ode_WORLD, space=self.ode_SPACE,
                                realObj=obj, density=0, friction=5000) )

obj = loader.loadModelCopy('misc/rgbCube')
obj.reparentTo(boxes)
obj.setPos(0,-2.5,0)
obj.setScale(5,1,1)
self.simObjects.append( ODEbox( world=self.ode_WORLD, space=self.ode_SPACE,
                                realObj=obj, density=0, friction=5000) )

obj = loader.loadModelCopy('misc/rgbCube')
obj.reparentTo(boxes)
obj.setPos(0,2.5,0)
obj.setScale(5,1,1)
self.simObjects.append( ODEbox( world=self.ode_WORLD, space=self.ode_SPACE,
                                realObj=obj, density=0, friction=5000) )

For accurate placement :

  1. create those boxes in your modeler
  2. at runtime, all you need to do is find them and do as above code. My method takes care of the transform for you.

yep, i’ve tried the example you posted in the thread. Never got it to run though, here is why:

D:\Programme\Programming\Eclipse\workspace\tischfussball>ppython test.py
DirectStart: Starting the game.
Warning: DirectNotify: category 'Interval' already exists
Known pipe types:
  wglGraphicsPipe
(3 aux display modules not yet loaded.)
Traceback (most recent call last):
  File "test.py", line 851, in ?
    World()
  File "test.py", line 493, in __init__
    self.startScene1()
  File "test.py", line 833, in startScene1
    self.sceneSetup(numBodies=40)
  File "test.py", line 815, in sceneSetup
    self.drawCage()
  File "test.py", line 526, in drawCage
    realObj=obj, density=0, friction=5) )
  File "test.py", line 98, in __init__
    self.geom.setQuaternion(obj.getQuat(render))
  File "geomobject.pyx", line 73, in ode.GeomObject.__getattr__
AttributeError: geom has no attribute 'setQuaternion'.

Since i know geom has an attribute setQuaternion, i didn’t know what to do and didn’t investigate any further since this code seems to sophisticated for my needs anyway.

That’s super weird. Which version of PyODE are you using ? The v1.2 released Feb 07.
From the v1.2 manual :

From the v1.2 source (geomobject.pyx) :

    def getQuaternion(self):
        """getQuaternion() -> (w,x,y,z)

        Get the current orientation of the geom. If the geom is attached to
        a body the returned value is the body's orientation.
        """
        if not self.placeable():
            raise ValueError, "Non-placeable geoms do not have an orientation."

        cdef dQuaternion q
        dGeomGetQuaternion(self.gid, q)
        return (q[0],q[1],q[2],q[3])

    def setQuaternion(self, q):
        """setQuaternion(q)

        Set the orientation of the geom. If the geom is attached to a body,
        the body's orientation will also be changed.

        @param q: Quaternion (w,x,y,z)
        @type q: 4-sequence of floats
        """
        if not self.placeable():
            raise ValueError, "Cannot set a quaternion on non-placeable geoms."

        cdef dQuaternion cq
        cq[0] = q[0]
        cq[1] = q[1]
        cq[2] = q[2]
        cq[3] = q[3]
        dGeomSetQuaternion(self.gid, cq)

that would probably be the problem, i downloaded pyODE around last years december, so i’m still working with 1.1. Downloading the new version right now.

k, i’m now working with 1.2. That did the trick. One last question: what does the “w” stand for in (w,x,y,z). Thanx for all your help.

Well, while i’m at it, i’ll ask another question. How do i attach a geomObject to an existing model. In my case I would like to attach a geomBox to a player to initialize collisions with the ball. Here a screen:

firstblood.de/test2.JPG

If i understood well, I don’t want to attach bodies with the players, they just need a geomBox attached. Since the players can slide on the x-axis and rotate on the y-axis, I would like to attach the geomBoxes to move with the players, to be able to “kick” the ball.

I allready tried to move the boxes with the player models through the mouse input, like i did with the models, but i had some problems with the rotation of the boxes:

if base.mouseWatcherNode.hasMouse():
           mpos = base.mouseWatcherNode.getMouse()
      
           self.stange1.setPos(1.75, -mpos.getX(), 1.25)
           
           self.griff1.setPos(1.75, -6.25 - mpos.getX(), 1.25)
           
           self.spieler11.setPos(1.75, 2.75 - mpos.getX(), 1.25)
           self.spieler11.setHpr(180, 0, mpos.getY() * 50)
           
           self.spieler12.setPos(1.75, -mpos.getX() * 1.25, 1.25)
           self.spieler12.setHpr(180, 0, mpos.getY() * 50) 
           self.geomSpieler12.setPosition((1.75, -mpos.getX() * 1.25, 1.25))
           self.geomSpieler12.setQuaternion((1, 180, 0, mpos.getY() * 50))       
            
           self.spieler13.setPos(1.75, -2.75 - mpos.getX(), 1.25)
           self.spieler13.setHpr(180, 0, mpos.getY() * 50)

Collisions stopped occurring with that code, while they still occur if i leave the self.geomSpieler12.setQuaternion((1, 180, 0, mpos.getY() * 50)) part out.

read more about quaternion :
en.wikipedia.org/wiki/Quaternion

Try this :

self.geomSpieler12.setQuaternion(self.spieler12.getQuat())

thx that helped