ekt
25-06-2007 14:11:03
Hi all
yesterday i finally came back to this issue http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=2958
Basically i want to take control of the contact generation process during collision detection.
In the above post, Tuan offered this way
It sounds ok but i don't love it for at least two reason. One is I want to step my self, not using ogreode steppers and listeners, the other is not having to fill this client_side list each time. So, being stubborn or masochist (or both) i've tried to write my own contact management while still keeping OgreOde intact.
In the end, what I want is call dCollide() by myself. Which is called in Geometry->collide(), which in turn is called by OgreOde::World::collisionCallback. So, during collision detection, instead of
Then in my own collisionCallback, instead of geometry->collide(), I call a static CollideGeometries(), in which in the end i'll be able to call dCollide() and do my own mess with contacts.
It's not that difficult. And it doesn't work.
Now, i should stop here and do what tuan said, except i'm thickhead and that it fails in a way i don't get.
When calling dCollide, ode asserts with this
This 'colliders_initialized' is defined in collision_kernel.cpp as
I've stepped in ode, it gets initialized. But then when in dCollide, is magically 0 again. The only way colliders_initialized gets zeroed in code is in dWorldDestroy, which is not the case.
The worst part is this. If I move my ContactManager class inside OgreOde, then it works.
I know, i know, i know, but... ideas?
yesterday i finally came back to this issue http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=2958
Basically i want to take control of the contact generation process during collision detection.
In the above post, Tuan offered this way
Use Collision Listener to register contact in a list client-side. Your listener add contact in a list each time called and return false to prevent ogreode creating contacts. Then in OgreOde with a client_side registered stepListener where middleStep is overriden, do the contact merging on your list and do the djointattach work here.
It sounds ok but i don't love it for at least two reason. One is I want to step my self, not using ogreode steppers and listeners, the other is not having to fill this client_side list each time. So, being stubborn or masochist (or both) i've tried to write my own contact management while still keeping OgreOde intact.
In the end, what I want is call dCollide() by myself. Which is called in Geometry->collide(), which in turn is called by OgreOde::World::collisionCallback. So, during collision detection, instead of
mWorld->getDefaultSpace()->collide();
I call directly dSpaceCollide() passing my own collisionCallback (basically a copy and paste from OgreOde::World::collisionCallback).Then in my own collisionCallback, instead of geometry->collide(), I call a static CollideGeometries(), in which in the end i'll be able to call dCollide() and do my own mess with contacts.
It's not that difficult. And it doesn't work.
Now, i should stop here and do what tuan said, except i'm thickhead and that it fails in a way i don't get.
When calling dCollide, ode asserts with this
dUASSERT(colliders_initialized,"colliders array not initialized");
This 'colliders_initialized' is defined in collision_kernel.cpp as
static int colliders_initialized = 0;
and it gets initialized the first time you create a geom.I've stepped in ode, it gets initialized. But then when in dCollide, is magically 0 again. The only way colliders_initialized gets zeroed in code is in dWorldDestroy, which is not the case.
The worst part is this. If I move my ContactManager class inside OgreOde, then it works.
I know, i know, i know, but... ideas?