panda3d + pyOde

Hi folks… once again i am here.

I searched the forums and web but couldnt make a trimesh collision in panda.

I get the following error:

Traceback (most recent call last):
  File "", line 3, in <module>
    w = World()
  File "/", line 85, in __init__
  File "/", line 49, in addTerrain
    td = ode.TriMeshData()
  File "trimesh_dummy.pyx", line 33, in ode.TriMeshData.__init__
TypeError: exceptions must be strings, classes, or instances, not type

This is my code:

import ode
from pandac.PandaModules import *
from direct.task.Task import Task
from direct.interval.IntervalGlobal import *
import Util

class Physics:
    def __init__ (self):
        ## Inicializa física
        self.odeWorld = ode.World()

        self.odeSpace = ode.Space()

        ## Objetos controlados pela física
        self.objectList = []

        ## Delta de tempo entre calculos
        fps = 50
        self.dt = 1.0 / fps 


    def addEntity (self, ent):
        ent.odeBody = ode.Body(self.odeWorld)
        M = ode.Mass()
        M.setSphere(2500, 5)
    def checkCollisions (self, task):
        for ent in self.objectList:

        return Task.cont

    def addTerrain (self, ent):
        points,tris = Util.LerMesh(ent.nodePath)
        td = ode.TriMeshData(),tris)
        ent.odeGeom = ode.GeomTriMesh(td,self.odeSpace)
        ent.odeGeom.setQuaternion(ent.nodePath.getQuat()) = 'Terrain'

Any tips?

Did you build pyode yourself ?
Which version are you using ?

PyODE will not accept a panda nodepath as an argument. You need to use the ODE integrated with Panda if you want to do that. When you do that in the integrated ODE you pass the model to the GeomTrimesh in two steps:

nodeTrimesh = OdeTriMeshData(modelNodePath, True)
trimeshGeom = OdeTriMeshGeom(myOdeSpace, nodeTrimesh)

I don’t think it’s the problem. That nodepath is not passed to pyode, but to his util.lermesh.
The error is an error when raising an exception, in trimeshdata.init, indicating that trimesh support is not compiled in. There is a proof of that, in, TRIMESH_ENABLED is set to false.

Doh. I guess thats true. But using PyODE also seems a bit redundant with ODE already being integrated in 1.5.3 unless he’s using an older verson.

thanks a lot for the replys.

The problem is that i didnt build panda. I am using panda-1.5.3.deb for ubuntu feisty.

I am using Ode instead of panda integration because i was getting this error. so i was trying something different

i changed all the ode stuff to panda objects and it executed!!

although i am still having problems with trimesh collision… i did like this:

 54     def addTerrain (self, ent):
 55         ent.nodePath.flattenStrong()
 56         ent.modelTrimesh = OdeTriMeshData(ent.nodePath, True)
 57         ent.modelGeom = OdeTriMeshGeom(self.odeSpace, ent.modelTrimesh)

what more i need to do in order to have an effective trimesh collision?

i manage to make it work… i was not using autoCollide. thanks a lot :slight_smile: