GreenVicted
09-03-2009 01:20:02
How do i add the physical mesh to a room.mesh?
I'm kind of a newb with Ogre i tried.
Level=DetritusPrimeApp::GetInstance().GetPhysicsScene()->createBody("scene.mesh",new NxOgre::Convex(100,100),Vector3(0,0,-100),"static: yes");
But a memory crash comes up(i think it crashes because there is some information missing,same thing for TriangleMesh) ,the only 2 bodies i can give my scene.mesh (it's 2 rooms) is a big cube our capsule it's good to limit the level but it does not give me physic inside the level...
Can someone help me, please?
P.S are triangle and convex shapes used to apply physics to a terrain/level/room?
And is there a way to "convert" or transform my scene.mesh to a TriangleMesh or Convex.
betajaen
09-03-2009 10:37:55
You would use a TriangleMesh and not a Convex for a room.
Just use flour to convert your Ogre mesh into a NXS triangle one, and there are more than a few examples around here - about working with TriangleMeshes and Actors.
GreenVicted
09-03-2009 18:46:22
Thanks BetaJean, but i still have a memory crash when i try to load my scene_triangle.nxs.
And i get an exception about not finding my characters in their sceneNode,something like that, when i changed my sceneManager from a ST_GENERIC to an ST_INTERIOR one.
nargil
09-03-2009 19:51:54
So you need to fix it, or "something like that". There is no such a havy error in NxOgre. You must be doing something wrong, and we can't help you if you don't post your code nor the exact error messages.
GreenVicted
09-03-2009 23:39:32
Sorry, i wanted to specify my problems but the campus i work at decided to block the posting on your forums. By the way sorry for the Mispelling Betajaen.
Here is the code followed by the error,and the something like that part was not crucial beacause i know i changed form generic SceneManager to interior sceneManager.
But this is.
NxOgre::TriangleMesh* mTriangleShape = new NxOgre::TriangleMesh("scene_tri.nxs");
Level=DetritusPrimeApp::GetInstance().GetPhysicsScene()->createBody("scene.mesh",mTriangleShape,Vector3(0,0,-100),"static: yes");
The debugger stops at this line in memcpy_s.c.
memcpy(dst, src, count);
error:
Exception non gérée à 0x01157ea5 dans DetritusPrime.exe : 0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0xcdcdcdcd.
nargil
10-03-2009 00:15:54
0xcdcdcdcd <- thats an unitialized pointer.
Ogre::String meshIdentifierStr = "scene_tri";
Ogre::String filename(meshIdentifierStr+".nxs");
Ogre::String filepath("file://media/physX/");
if(!NxOgre::Resources::ResourceSystem::getSingleton()->hasMesh(meshIdentifierStr))
{
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs(filepath+filename,meshIdentifierStr);
}
NxOgre::Resources::Mesh* mesh = NxOgre::Resources::ResourceSystem::getSingleton()->getMesh(meshIdentifierStr);
NxOgre::TriangleMesh* mTriangleShape = new NxOgre::TriangleMesh(mesh);
GreenVicted
10-03-2009 00:50:15
Exception non gérée à 0x01256c88 dans DetritusPrime.exe : 0xC0000005: Violation d'accès lors de la lecture de l'emplacement 0x00000000.
NxOgre::Resources::ResourceSystem::getSingleton()->addMeshAs(filepath+filename,meshIdentifierStr);
This is the exeption i get at that line of code,take note that i can load anything else it's only when i want to use a convex or triangle shape that the application crashes.
nargil
10-03-2009 08:43:46
It can't find your .nxs file. You know that nxogre does not use the ogre resource system, right ? Check your working directory in your visual c++ project settings and put the nxs file there.
superrad
11-03-2009 11:25:06
Are you using version 1.0'21? (the only one thats available from the actual NxOgre website)
Being theres a bug in the NxOgre code that prevents triangle meshes from being loaded in correctly.
You need to apply Caphalor's fix in this thread (2nd post from the bottom of the page)
viewtopic.php?t=6891.
gmz1982
11-03-2009 15:30:47
Apart from the bug ( which You should correct and recompile ) your filepath to the .nxs is relative to the working directory.
For example, if your executable is here:
C:\OgreSDK\bin\release\xxxxx.exe
Then you should use:
Ogre::String filepath("file://../../media/physX/");
( that is 2 levels up from "\release\" then goes to "/media/physX/" )
If you have put your .nxs to a place where the application finds it, it is OK, but you should correct the path because it won't be valid ( IF not valid ).
I hope it helps!