How to deal with NxOgre RessourceSystem?

Rasengan

14-07-2008 13:55:23

Hello,

I'm trying to load a static collision geometry, from Ogre mesh file, but I have an assertion failed while trying to read the file (from fseek call).

(STREAM != NULL)

Here is the code:

void createCollisionGeometry(void)
{
// Adding mesh to NxOgre ressources.
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://mesh1-geometry.mesh", "sablonCollisionMesh");

// Getting the Mesh.
NxOgre::Resources::Mesh* collisionMesh =
NxOgre::Resources::ResourceSystem::getSingleton()->getMesh("sablonCollisionMesh");

// Link the mesh with static actor.
NxOgre::Actor* collisionActor =
mScene->createActor
(
"Collision Mesh",
new NxOgre::TriangleMesh(collisionMesh),
Vector3(0, 0, 0),
"static: yes"
);
}


There is another thing to set for NxOgre ressources System?

Thanks for reply.

betajaen

14-07-2008 14:09:17

You have to convert the meshes using Flour before you use them in NxOgre.

Rasengan

14-07-2008 14:40:38

It works!

I'have put the .nxs in the same directory of .exe and I'have to deal with mesh orientation but it works.

Thanks for help!

Edit: I have previously applied the fix posted by Caphalor
here: http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=6891

betajaen

14-07-2008 16:07:04

If you want to. You could use meshmagick to change the direction of the mesh, or I wonder if you could flip the mesh by applying a negative scale.


I should really add another file-format to Flour; I was thinking of using "obj" since it's all open source and what not.

Rasengan

14-07-2008 16:39:14

I have used MeshMagick to apply transforms.

The .nxs scale is little higher than the mesh file used in renderer, so collisions does'nt match perfectly.

Is'nt the mesh scale exactly the same as nxs file, or I made something wrong in the convertion process?

betajaen

14-07-2008 16:48:43

There is a little bit extra added in PhysX known as skin-width; it's 0.025 in NxOgre. You can calculate the scale from that and it should match up.

Rasengan

14-07-2008 17:34:36

I' have tryed this:

MeshMagick.exe transform -scale=1.025/1.025/1.025 mesh1-geometry.mesh

But the collision mesh (.nxs) is still bigger than the .mesh.

betajaen

14-07-2008 17:56:58

No, the other way. It would be 0.9 something.