Crash in a trivial sample

mikachu

11-09-2007 20:10:26

Hi,
I've got the latest NxOgre 0.9 from SVN and PhysX 2.7.2.
I compiled everything happily with VC8 Express, and tried NxOgre with a very simple sample :


World *mWorld = new World();
Scene* mScene = mWorld->createScene("Main",mSceneMgr, "gravity: yes, floor: yes");
Body *myBody = mScene->createBody("mybody; barrel.mesh",new CubeShape(1,1,1),Vector3(0,3.5,0), "mass: 10");

The crash is in the call to mScene::createBody, more precisely the line: mActors.lock(body->getName(), true);
I did a little bit of debugging, and the debugger shows that at this point, the"this" pointer points to some odd place, because it is modified during the call to Body* body = new Body(identifier, this, firstShapeDescription, pose, params);
BTW, all files needed are there, and there's nothing wrong in Ogre.log.

betajaen

11-09-2007 20:19:17

Your code is fine, I use that same three line code all the time, several thousand times a day.

Can you double check that the NxOgre.dll you compiled is the same one your application is working with. Stupid I know, but I need to rule out the easy bits first.

mikachu

11-09-2007 21:31:01

I recompiled NxOgre, my app, and re-checked that the dlls were the good ones, but it doesn't seem to be wrong. My app still crashes in the Body constructor (the "this" pointer of Body is screwed in the constructor)

betajaen

11-09-2007 21:39:14

Are you using cake? I've discovered a bug with that code using Cake.

mWorld = new World();
mScene = mWorld->createScene("Main",mSceneMgr, "gravity: yes, floor: yes");
Body *myBody = mScene->createBody("mybody; barrel.mesh",new CubeShape(1,1,1),Vector3(0,3.5,0), "mass: 10");


Hint. It's the World and Scene bit.

mikachu

11-09-2007 22:36:09

No, I'm not using cake. Just my simple, basic, Ogre initialisation code, and then the piece of code I quoted.
Do you mean that the bug is actually in my code? I tried using the initialisation code in 'cake.cpp', just replacing the name of the mesh, and I get the same error.
Should I also use Cake to find my error?

betajaen

12-09-2007 09:03:06

Well it's usually better to test things in cake if something doesn't work. But if your getting a crash with it; using my modified code then something is wrong.

All I can say now, is try re-downloading the SVN from scratch (erase the NxOgre directory) and recompile.

I and several others here use the body code all the time, and it's fine.

mikachu

12-09-2007 22:08:52

I've re-downloaded nxogre and cake, upgraded to Ogre 1.4.4 from 1.4.2, and rebuilt everything.
It just runs without a scratch now, thank for help