Problems to load Convex/Trianglemesh

Frederick

02-12-2008 11:08:59

Hi for all,

I wrote a code to load a ".nxs" file, but the LOG say "File 'pltCxv.nxs' could not be opened for Reading" and the name of the file is correct.

I placed the file in the folder of the project and wrote the reference in the "resources.cfg", but the error persist.

I create with "flour" a convex and a trianglemesh for test, but the error persist.

The code to convex is:
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://pltCxv.nxs","teste");
NxOgre::Convex *cnv = new NxOgre::Convex("teste");
NxOgre::Body *body = mNxScene->createBody("bodytest", cnv, pos, nrp, "mass: 10");


The code to trianglemesh is:
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://pltTri.nxs","teste");
NxOgre::TriangleMesh *cnv = new NxOgre::TriangleMesh("teste");
NxOgre::Body *body = mNxScene->createBody("bodytest", cnv, pos, nrp, "static: yes");


The two codes above generate the error.

Please, help me!! T_T

Att,
Diogo Manhães.

betajaen

02-12-2008 11:15:13

You need a relative or absolute path to that. NxOgre doesn't use Ogre for resources.

Frederick

02-12-2008 12:16:32

Can you post to me some examples.

I move the files to "C:" to test the absolute reference and modify the reference to "file://c:/pltCxv.nxs".

It's correct??

the error change to "File 'c:/pltCxv.nxs' could not be opened for Reading".

Att,
Diogo Manhães.

Toby

05-12-2008 08:16:59

For my track trianglemesh I place my nxs in exe repository.

And my code is:
::NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://"+trackName+".nxs", trackName+".nxs");

trackBody = _scene->createBody(trackName, new NxOgre::TriangleMesh(trackName+".nxs"), _pos, "model: "+trackName+".mesh", "static: yes");

mcaden

05-12-2008 08:55:36

use this:

NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://../../media/models/test.nxs", "test.nxs");

You may have to add or remove some of the ../ in order to get it right, basically use 1 ../ for every level up the chain from your working directory. For example, I use:

/
/media/models
/Bin/Release
/Bin/Debug

So, I use

file://../../

to get from Release (or Debug) back to

/

then media/models to get to the directory I want.

Frederick

05-12-2008 11:23:11

I place the nxs file in the folder of the exe file and wrote this code:

NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://pltTri.nxs","TryNXS");
NxOgre::TriangleMesh* mTriangleShape = new NxOgre::TriangleMesh("TryNXS");
mScene->createBody("BodyNXS", mTriangleShape , Ogre::Vector3(0, 0, 0), "","static:yes");


But this error appear in the log file:

Mesh (file://pltTri.nxs) could not be loaded! - Mesh is already loaded


I don't know what I do to fix this error!! T_T

Att,
Diogo Manhães.

betajaen

05-12-2008 11:29:46

It means the file can't be found or some other operating system error. Most likely it can't be found.

Frederick

05-12-2008 11:33:19

I post a wrong code, but I edit this!!

Code:
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs("file://pltTri.nxs","TryNXS");
NxOgre::TriangleMesh* mTriangleShape = new NxOgre::TriangleMesh("TryNXS");
mScene->createBody("BodyNXS", mTriangleShape , Ogre::Vector3(0, 0, 0), "","static:yes");



Error:

Mesh (file://pltTri.nxs) could not be loaded! - Mesh is already loaded

Att,
Diogo Manhães.

mcaden

05-12-2008 14:38:49

check the rest of your code, make sure you're not calling "addMesh" or "addMeshAs" somewhere else in the code.

Frederick

05-12-2008 19:31:42

I only have this commands in the code, what left is the creation of the world, scene and the other fundamentals codes.

But the error persists!! T_T

Att,
Diogo Manhães.

Toby

06-12-2008 11:36:04

Hum, strange but only difference with my code is :: before NxOgre.