[SOLVED] Physical Level Creation

MindCalamity

20-09-2011 23:30:23

Me again, on my question spree :D

The question this time around, is how to create a physical representation of my level, I merged all the immobile objects on my scene into one big mesh, exported to .flower, and converted to .nxs triangle mesh.

I have no idea how to create triangle geometry from the renderable and physical mesh, to be precise, I have no idea which shape description I should use, since BoxDescription is out of the question.

<edit>Damn, it seems like my code was totally wrong, I just fixed the arguments like this:

NxOgre::Mesh* castleMesh = NxOgre::MeshManager::getSingleton()->load("ogre://castle.nxs", "Castle Physical");

NxOgre::TriangleGeometryDescription castleTriDesc;
castleTriDesc.mMass = 0;
castleTriDesc.mMesh = castleMesh;
GameFramework::getSingletonPtr()->mLog->logMessage("Creating Level...");
Critter::BodyDescription castleBodyDesc;
castleBodyDesc.mMass = 0;
NxOgre::TriangleGeometry* castleTriGeom = GameFramework::getSingletonPtr()->mRenderSystem->createBody(castleTriDesc, NxOgre::Vec3(0, 0, 0), "castle.mesh", castleBodyDesc);
GameFramework::getSingletonPtr()->mLog->logMessage("Level Created...");


And BOOM, this is what I get:

1> GameState.cpp
1>src\GameState.cpp(212): error C2440: 'initializing' : cannot convert from 'Critter::Body *' to 'NxOgre::TriangleGeometry *'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast


So how exactly is Triangle Geometry created ?

Or am I wrong for even thinking that Triangle Geometry should be used for stuff like physical representations of game levels ?
</edit>

MindCalamity

21-09-2011 02:20:31

I finally got it to work, but I still don't have collision, even though the visual debugger shows that the physical mesh is there and properly exported and converted.

I made a video to show my problem:

http://www.youtube.com/watch?v=GesnKCRpJIY

MindCalamity

21-09-2011 05:11:23

After about 3 hours of epic battling, I finally managed to defeat my opponent (my mind, which refuses to take notice of simple problems)

So, the problem was, I didn't add the geometry I just created to the Shape Groups of the triangle description, and the solution was as complicated as adding this:



castleTriDesc.mGroup = 1;

I seem to be having only simple problems lately, as compared to a few months ago, when I first tried to integrate NxOgre :D