Fail to cook in runtime?

razi

14-04-2011 17:55:47

Hi, in my application u want to use meshes to create the physical bodies in runtime. I found this code and it compiles but throws error at cook(). What is wrong with the code, it seems fine to me? I use Detritus and Ogre 1.7.1.

Ogre::Entity* myEnt = mSceneMgr->createEntity("myEntity", "cube.mesh");
Ogre::MeshPtr mPtr = myEnt->getMesh();
NxOgre::MeshData* mesh_data = Critter::MeshFunctions::read(mPtr);
mesh_data->mType = NxOgre::Enums::MeshType_Convex;
mesh_data->cook("file://my_mesh.nxs");
delete mesh_data;

Thank you.

betajaen

14-04-2011 18:16:30

Try cooking it as a triangle mesh first, if that works then the cooking process is okay; it's the mesh that PhysX is having problems with. (Convex meshes have a vertex limitation and some strange quirks).

razi

14-04-2011 19:07:30

It doesnt work for triangle either, I know about convex vertex limitation so I chose just simple cube. :(

betajaen

14-04-2011 19:35:20

Can you trace the error to the offending line (it will be in a NxOgre cpp file)

razi

14-04-2011 21:09:54

Oh, i found out it was because I was calling it before creating the world, I didnt think world has anything to do with creating nxs, sorry. :)

betajaen

14-04-2011 21:13:44

It's responsible for starting up the PhysX SDK. You don't need anything else created though.

rromulo

30-05-2011 19:41:45

Since now sorry about my poor English...
I didn't understood so well about "cook" function.
As I am new in NxOgre, I saw that I can use the "cook" function to set scale and orientation as I do in my mesh archives, something that a need too much in my project.
Then, could someone explain me how to do it or post code lines showing how to scale the mesh and the nxs?
Tks for all.