[bleeding]cannot create actor

Dutchie

08-04-2008 16:19:12

I have a problem with creating an actor.

I use this code to create the actor:
Ogre::String file = "file://triangle/wall.mesh.nxs";
NxOgre::TriangleMesh *mesh = new NxOgre::TriangleMesh(file);
NxOgre::Actor *MyAct = NxScene->createActor("Actor"+MyNode->getName(), mesh, MyNode->_getDerivedPosition(), "static: yes");


MyNode is an node in the ogre scene which has an entity attached to it. In my program folder i have a folder triangle where all the triangle meshes are.

When i run this code it crashes at this line:
shapes.push_back(&mShapeDescription);
file: nxogreshapemeshes.cpp

betajaen

08-04-2008 16:30:59

I don't think the FileResource class can handle directories. Move the wall.mesh.nxs to the same directory as the executable.

Dutchie

08-04-2008 17:17:35

i checked it out again... When starting the instance from VS it crashes at:

line 195: mShapeDescription.meshData = mMesh->mMesh.mTriangleMesh;
and when starting it externally and after the crash select debug renderer at the line in my starting post:
line 202: shapes.push_back(&mShapeDescription);

moving the content to the main directory gives the same.

betajaen

08-04-2008 17:37:50

It could be a bad mesh then. Have you tried the TriangleMesh shape with something simpler such as converting the cube.1m.mesh to a cube.1m.nxs using Flour?

Dutchie

08-04-2008 18:02:11

doesnt work either...

maybe it has something to do at how i setup the scene?


NxWorld = new NxOgre::World("FrameListener: No, log: html");
NxScene = NxWorld->createScene("PhysXScene", SceneManager, "gravity: yes, renderer: ogre");

betajaen

08-04-2008 18:16:37

That's fine. Although you can drop the framelistener bit and replace "log: html" with "log: yes" and drop "SceneManager" in the createScene.

Would you post your mesh here, and I'll see if it works in Cake for you.

Dutchie

08-04-2008 18:28:02

here it is:

please click me!!

added the triangle nxs also...

Dutchie

09-04-2008 20:28:55

did you have time to check it yet?

betajaen

09-04-2008 20:57:30



mScene->createActor("Test", new TriangleMesh("file://straightWall01.mesh.nxs"), Vector3(0, 10, 0), "static: yes");

Works fine.

Dutchie

09-04-2008 21:19:20

than it is something in my app... thanks, i will check it out.

which librarys have to be linked? maybe that is the problem.

Dutchie

10-04-2008 10:58:36

i just found in the NxOgre log a leak:

Mesh::load

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


could that be the problem? because i can't seem to find something else.
and im 100% sure i didn't load the file before.

betajaen

10-04-2008 11:11:52

Interesting. If you want, you can PM me the related source and I'll have a look for you; Just the CPP/H files that use NxOgre.

Dutchie

10-04-2008 14:19:30

pmed you, you pmed me back that it should be fine...

tried to remove stuff from my app. Caelum removed, PCZSceneManager changed to terrain scene manager, loaded it by not running loadLevel function but just createActor in constructor. doesn't work all...

maybe it is a driver problem... That the SDK and/or driver are installed wrong? i will reinstall them(first driver) and will now try the big installer instead of small one...

Caphalor

10-04-2008 16:07:20

I got the same error message, I posted my solution here (last but one post).

betajaen

10-04-2008 16:45:35

Do'h! Must of missed your post and the fix. I've also probably missed the error since I work in Debug Mode quite often which initialises mMaterialAlias on the construction of Mesh.

Anyway, I've added your change in. Hopefully this should fix Dutchies problem.

Dutchie

10-04-2008 17:59:43

i have added the things caphalor mentioned in NxOgre, but it didn't work...

Caphalor

10-04-2008 20:37:24

Do you still get the message "Mesh (file://triangle/straightWall01.mesh.nxs) could not be loaded! - Mesh is already loaded"? Did you replace your NxOgre dll with the new one?

Dutchie

10-04-2008 21:37:42

yes, i replaced the old with the new compiled ones...
and no, i don't have the message anymore about the mesh is already loaded. but the rest of the problem is the same.

btw, it has something to do with the triangle shape... because when i do new NxOgre::Cube(1) it doesn't crash.

Caphalor

10-04-2008 22:05:51

To be sure that you really have another error than me try this:

NxOgre::Resources::ResourceSystem::getSingleton()->addMesh("file://triangle/wall.mesh.nxs");
NxOgre::Actor *MyAct = NxScene->createActor("Actor"+MyNode->getName(), NxOgre::Resources::ResourceSystem::getSingleton()->getMesh("triangle/wall.mesh.nxs"), MyNode->_getDerivedPosition(), "static: yes");

betajaen

10-04-2008 22:09:15

Actually. I think the problem may be that the ResourceSystem doesn't really understand directories and treats the path of the mesh as the full file name.

Perhaps I should add a "getRealName()" function to each ResourceManager to cut out directory names, volume labels, port addresses and other bits of a ResourceIdentifier may have.

BTW: Dutchie those "files" you sent me. Didn't work.

Dutchie

11-04-2008 08:10:10

@caphalor:
i think it should be:


NxOgre::Resources::ResourceSystem::getSingleton()->addMesh("file://triangle/wall.mesh.nxs");
NxOgre::Actor *MyAct = NxScene->createActor("Actor"+MyNode->getName(), new NxOgre::Triangle(NxOgre::Resources::ResourceSystem::getSingleton()->getMesh("triangle/wall.mesh.nxs")), MyNode->_getDerivedPosition(), "static: yes");


if i do it like that it works :O

so i think the problem is solved by using that way...

I think the bug is in the shape part of createActor.
When i use:
new NxOgre::Triangle("file://triangle/cubeblabla.nxs")

it crashes...

this problem is solved now, thanks guys for your time!

Caphalor

11-04-2008 13:10:19

Wah copy and paste is evil, of course I also have "new NxOgre::TriangleMesh(..." in my code. But I'm glad that it works for you now. :)