Scalling and generateTriangleMesh !

ahmadi

23-08-2006 10:36:26

i want create a static trimesh :
after calling "void generateTriangleMesh()" function , i have in my log that
"[NxOgre] Failed meshShape cooking for Entity"
!!
what is wronge, in my tracking i reach this code in the function that NxCookTriangleMesh return false and "else{}" run !!


if (NxCookTriangleMesh(mTriangleMeshDescription, buf)) {
mShapeDesc.meshData = gPhysicsSDK->createTriangleMesh(MemoryReadBuffer(buf.data));
}
else {
Ogre::LogManager::getSingleton().logMessage("[NxOgre] Failed meshShape cooking for Entity '" + e->getName() + "'.");
}


dont forget my mesh is your "nx.stairs1.mesh" and mesh is correct, i think that i must preconfigure NxCook . what do you think?

betajaen

23-08-2006 10:54:01

Show me your meshShape code.

ahmadi

23-08-2006 11:13:47

Show me your meshShape code.

generateTriangleMesh(e);
NxActorDesc mActorDescription;
mActorDescription.shapes.push_back(&mShapeDesc);
mActorDescription.body = NULL;
mActorDescription.density = 10;
gScene->createActor(mActorDescription);

betajaen

23-08-2006 11:37:07

It seems that your not getting the result of generateTriangleMesh into mShapeDesc.

ahmadi

23-08-2006 11:41:34

It seems that your not getting the result of generateTriangleMesh into mShapeDesc.
its your code form your function:

if (NxCookTriangleMesh(mTriangleMeshDescription, buf)) {
mShapeDesc.meshData = gPhysicsSDK->createTriangleMesh(MemoryReadBuffer(buf.data));
}
else {
Ogre::LogManager::getSingleton().logMessage("[NxOgre] Failed meshShape cooking for Entity '" + e->getName() + "'.");
}


ya you right because
mShapeDesc.meshData = gPhysicsSDK->createTriangleMesh(MemoryReadBuffer(buf.data));
never run!!! and "if statement" always return false !!

betajaen

23-08-2006 11:49:56

Well then, there must be something with your mesh. Try others, like cube.1m.mesh.

ahmadi

23-08-2006 12:21:24

My problem has been solved,
Thank you very much :P

ahmadi

23-08-2006 19:05:37

betajaen, excuse me again.
but if i scale my mesh in ogre then generateTriangleMesh also make original trimesh and dont generate scalled mesh, what must i do? :cry:

betajaen

23-08-2006 19:23:19

What? Your speaking weird.

You've scaled a mesh in Ogre, and you want that scaled mesh to work in generateTriangleMesh?

No it won't work, you'll have to scale the mesh externally then save it.

BlasterN

25-08-2006 02:18:59

I have an idea.

Search in the main forum, "Scale Mesh". You will find a little program that do a mesh scaling and then save it. Source code is available.

Just use this code but not save the mesh.
If your mesh have instances with different scale, remember to clone the original mesh.