createDebugRenderer() crash

Gf11speed

22-06-2008 03:25:05

I'm having a problem in createDebugRenderer() with NxOgre 0.9. I'm just trying to do something simple as this:

mWorld = new World();
mWorld->createDebugRenderer(mSceneMgr);

Scene *mScene = mWorld->createScene("myScene", mSceneMgr, "gravity: yes, renderer: ogre, controller: accumulator, floor: yes");

Body* body = mScene->createBody("Bob;ninja.mesh", new CubeShape(1.0f), Ogre::Vector3::ZERO, "mass: 10");



And it crashes in createDebugRenderer(). If I step through it, I track it to the constructor of DebugRenderer, where mNode is getting corrupted.

Here is the constructor:
DebugRenderer::DebugRenderer(Ogre::SceneManager *_mgr) {

mSceneMgr = _mgr;
mName = "NxDebugRenderer";
mNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(mName);
mNode->attachObject(this);

if(!Ogre::MaterialManager::getSingleton().resourceExists("NxOgre.DebugRenderer")) {

Ogre::MaterialPtr debugMat = Ogre::MaterialManager::getSingleton().create("NxOgre.DebugRenderer", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

Ogre::Technique* tech = debugMat->createTechnique();
Ogre::Pass* pass = tech->createPass();
pass->setVertexColourTracking(Ogre::TVC_AMBIENT|Ogre::TVC_DIFFUSE);
pass->setDepthWriteEnabled(true);
pass->setLightingEnabled(true);

}

this->setMaterial("NxOgre.DebugRenderer");

mRenderOp.vertexData = new Ogre::VertexData();

mNode->setVisible(true);
setVisible(true);
}


It crashes on the 'mNode->setVisible(true)' call because mNode is corrupted.

If I don't call 'mWorld->createDebugRenderer(mSceneMgr)' everything works fine.

Any ideas as to what's going on? Doesn't seem like anyone else is having this problem and I didn't want to modify the engine code.

Unfortunately I don't have access to two systems so I have to use this method to debug.

*Note: This crash occurred on NxOgre 0.9 and also the latest Bleeding version as of today.

Gf11speed

22-06-2008 17:39:20

Its important to get debugging capabilities working or we won't be able to use NxOgre for our project. Hopefully this an be solved quickly as we are currently deciding which physics engine to use.

Gohla

22-06-2008 18:00:09

Check the Ogre.log, does it say anything usefull?

Btw, the PhysX SDK comes with a Remote debugger program, it lets you see the physics shapes and joints that are currently in the simulation along with all the data of the objects.
To use it you need to add this line of code to your World initialization:
mWorld->getPhysXDriver()->createDebuggerConnection();
Start the Remote debugger (Start->Programs->AGEIA PhysX SDK->Tools->RemoteDebugger), start your application and then go to the debugger to see the current state in the debugger.

Gf11speed

23-06-2008 02:03:08

I seem to have gotten the remote debugger working, thanks. Is there any way to see debug geometries in the game itself? What's the best way to ensure the physics bodies match the actual .mesh model?

Gohla

23-06-2008 08:13:22

The DebugRenderer would probably do that, but you need to get that working then :P
In Bleeding, to create an accurate physics body for your meshes use the Flour tool (sticky in this forum) to generate convex or triangle meshes.

lonwolf

26-06-2008 08:13:34

any suggestions how to make the debugger work? Because i start it, then my game, then i switch back to the debugger and nothing happens (my firewall allows these programs to connect by the way..)

If i use Open, it needs a phx or pdx - which is yet to be seen somewhere in my game directory.. i have no dumps, is there a way to generate them and load them? or you can generate them only with the debugger.

So, anymore details about that would be apreciated, thanks

betajaen

26-06-2008 08:29:07

You have something like this in your code, right?

mWorld->getPhysXDriver()->createDebuggerConnection();

Then you start the debugger then your application.

lonwolf

26-06-2008 11:28:08

yes.. and still no nothing.. i can't see my bodies / actors

lonwolf

26-06-2008 16:36:16

nevermind, now it works, however i have to tweak my firewall every time i use the debugger because the game .exe changes and i receive an alert.. thanks!