GeomTriMesh collision problem

Help
wishkah256
2006-05-03
2013-05-14
  • wishkah256
    wishkah256
    2006-05-03

    Hi!

    I use pyOde with a little 2D game I'm writing in python. I'm faking a 2D environment by having the Z-center of all 3d meshes/bodies set to zero (e.g. a GeomBox spans from -0.5 to +0.5 on the Z axis).

    This works for GeomSpheres (balls) bouncing around on GeomBoxes (rects), but now I'm trying to implement TriMesh support (for Triangles), the problem is that a GeomSphere (representing a ball in my 2d game) would not jump straight up from the TriMesh, it would get accelerated in the Z direction and eventually fall off my -0.5 to +0.5 boxes >:(

    Vertizes I feed to my TriMeshData (a pyramid that representing an in-game triangle):
    frontside:
    coords1: (100.0, 100.0, 0.5)
    coords2: (100.0, 200.0, 0.5)
    coords3: (200.0, 100.0, 0.5)
    backside:
    coords4: (100.0, 100.0, -0.5)
    coords5: (100.0, 200.0, -0.5)
    coords6: (200.0, 100.0, -0.5)

    This is how I create the TriMeshData object:
    data = ode.TriMeshData()
    data.build((self.coords1, self.coords2, self.coords3, self.coords4, self.coords5, self.coords6), ((0,1,2), (5,4,3), (0,5,3),(0,2,5), (1,4,5),(1,5,2), (0,4,1),(0,3,4)))
    self.geom = ode.GeomTriMesh(data, self.map.space)

    I tried shuffeling the face indizes around a little, figuring that they have to face outwards to cause collision (like OpenGL triangles get only drawn when they face the viewport, counter-clockwise), to no avail.

    Any help highly appreciated!

     
    • wishkah256
      wishkah256
      2006-05-03

      The problem persist, and the output of all 8 triangles in the GeomTriMesh looks fine to me (retrieved using the getTriangle(i) method of the finished geom object):

      triangle 0: ((100.0, 100.0, 0.5), (100.0, 200.0, 0.5), (200.0, 100.0, 0.5))
      triangle 1: ((200.0, 100.0, -0.5), (100.0, 200.0, -0.5), (100.0, 100.0, -0.5))
      triangle 2: ((100.0, 100.0, 0.5), (200.0, 100.0, -0.5), (100.0, 100.0, -0.5))
      triangle 3: ((100.0, 100.0, 0.5), (200.0, 100.0, 0.5), (200.0, 100.0, -0.5))
      triangle 4: ((100.0, 200.0, 0.5), (100.0, 200.0, -0.5), (200.0, 100.0, -0.5))
      triangle 5: ((100.0, 200.0, 0.5), (200.0, 100.0, -0.5), (200.0, 100.0, 0.5))
      triangle 6: ((100.0, 100.0, 0.5), (100.0, 200.0, -0.5), (100.0, 200.0, 0.5))
      triangle 7: ((100.0, 100.0, 0.5), (100.0, 100.0, -0.5), (100.0, 200.0, -0.5))

       
    • Hi,

      I know this is a little delayed, but can you tell me what the mu value is for your collision joints?

      Ethan