NXS mesh troubles

GlorfindelRW

06-04-2009 02:17:10

Hello,

I'm trying to load NXS files, and I can't seem to get it to work.

I'm using Ogre 1.6, NxOgre 1.0.22T5, and PhysX 2.8.1.

I've searched all about the forums, and eventually discovered this post: viewtopic.php?f=6&t=7178.
I applied the fixes discussed therein and recompiled NxOgre and my program, and inserted the test statements there. I didn't have the mesh that was being used, so I instead used flour on cube.1m.mesh that came with cake.

flour convert in: cube.1m.mesh, into: convex, out: meshtest.convex.nxs
flour convert in: cube.1m.mesh, into: triangle, out: meshtest.triangle.nxs

I placed the resulting files alongside the .exe of my program. (C:\OgreSDK\bin\debug).

I get an exception on this line:

// Convex Test 1.
mNxScene->createActor("convex-test1", new Convex("meshtest-convex"), Vector3(0, 10, 0), "static: yes");

// The error:
// Unhandled exception at 0x008c8d05 in NxOgre_01.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.


Convex Test 2 yields: illegal call of non-static member function compiler error.

The triangle variants yield the same results.

Am I missing something? :(
I can post the whole source code if that would be helpful. Its just a small sample I've been using to try out NxOgre.

Thanks,
Glorfindel

GlorfindelRW

08-04-2009 06:33:39

I messed around with this a lot in the past couple days. I discovered that the following works.


NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://meshtest.convex.nxs", "yarr");
NxOgre::VisualIdentifier vi = "cube.1m.mesh";
NxOgre::Shape *shape = new Convex(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh( "yarr"));
NxOgre::Pose pose = NxOgre::Pose(NxVec3(0, 4, 0));
ActorParams aparams;
aparams.mMass = 0.0;
aparams.mDensity = 0.0;
NxOgre::Body* mBody = mNxScene->createBody(vi, shape, pose, aparams);


I'm still not entirely sure what I had done wrong in previous attempts, but its working now so whatever. :P I hope this saves someone else trouble in the future.