Ok, I found the _real_ problem behind terrain collisions. The problem
is, that we're creating a new classgeom*before* ode gets inited.
Because of this, when ode inits it rewrites the callbacks for
collisions, so our changes have no effect.
I'm testing with a special init function (called just after soya starts ODE) :
cdef int dTerrainClass # global!
cdef void geomterrain_init():
cdef dGeomClass dTerrainGeomClass
dTerrainGeomClass.bytes = 0
dTerrainGeomClass.collider = _TerrainGetColliderFn
dTerrainGeomClass.aabb = _TerrainGetAABB
dTerrainGeomClass.aabb_test = NULL # Need to write this function
dTerrainGeomClass.dtor = NULL
dTerrainClass = dCreateGeomClass(&dTerrainGeomClass)
#dSetColliderOverride(dTerrainClass,0, _TerrainCollide)
print "Created new terrain class: %d" % dTerrainClass
The problem here is, that my idea works, but pyrex creates wrong C
code. After patching the C code it works.
Pyrex thinks that "dTerrainClass" inside the function is a Python
Local variable. I've no idea about how to tell pyrex about a global C
variable.
Anyone knows how Pyrex differences between undeclared python objects,
and global C variables? in the same file (geom-terrain.pyx) is a
function that reads the global cdef int dTerrainClass and Pyrex treats
it as a global variable. I don't know why pyrex behaves differently
for my function (is the print call??)
___
Soya-user mailing list
Soya-user@gna.org
https://mail.gna.org/listinfo/soya-user