SimpleCloth in NxOgre

Vineeth@nxOgre

14-03-2008 11:55:35

I have basic understanding of how cloth is created in Ageia
The mycloth class as mkh42 described

I now tried in tutorial nxogre101 a simple program to create cloth



void start()
mWorld = newWorld();
mWorld->getPhysXDriver()->createDebuggerConnection();
mScene = mWorld->createScene("myScene", mSceneMgr);
mScene->setGravity(Ogre::Vector3(0,-9.8,0));
mScene->addFloor();


ClothParams cp;
cp.thickness = 0.2;
cp.bendingStiffness = 0.5;
cp.friction = 0.25;
cp.flags |= NX_CLF_BENDING;
cp.flags |= NX_CLF_COLLISION_TWOWAY;
cp.flags |= NX_CLF_HARDWARE;
cp.height=3;
cp.width=2;
cp.meshMaterial="nx.flag";
cp.density = 0.15;

mScene->createCloth("This is my cloth name",
NxOgre::Pose(Ogre::Vector3(0, 4, 0)),
cp);



But the program lands into trouble when accesing mcloth pointer in the NxOgreCloth.cpp with mcloth=0X00000000

what can I do? :cry:
you are really fast betajaen :wink:

spacegaier

14-03-2008 19:39:08

[Beware: I never worked with cloths so far -> just a proposal]

Try it with the second overload version of the createCloth() function and give as mesh as parameter (in the CakeApp is one).

Vineeth@nxOgre

15-03-2008 11:40:35

how about the third overload function with
NxClothDesc,NxMeshData and Meshptr


I want to implement a simple cloth...bare minimum

I am using the latest NxOgre but running tutorial 0.42 which is the only tutorial I have got.
I am using the old tutorial with new Nxogre_d.dll. i have other tutorials like joint and multishape actors running but not the cloth.help me out


please write a small code in the start() of the tutorial to create a cloth :cry:

spacegaier

15-03-2008 13:08:07

Isn't your code allready creating a cloth? Or where is your problem?

Vineeth@nxOgre

15-03-2008 13:24:25

No it is not.Any simple code will do for me
thank you spacegaeir for responding

spacegaier

15-03-2008 13:32:48

Don't know why your code crashes (also on my PC). However, the following lines work fine:

NxOgre::ClothParams cp("mesh-material: nx.flag, density: 0.15, thickness: 0.2, blending-stiffness: 0.7, friction: 0.25, width: 2, height: 3");
cp.flags |= NX_CLF_BENDING;
cp.flags |= NX_CLF_HARDWARE;
cp.flags |= NX_CLF_COLLISION_TWOWAY;
NxOgre::Cloth *cloth = m_pNxScene->createCloth("cloth", NxOgre::Pose(Vector3(0,10,0)), cp);

Vineeth@nxOgre

17-03-2008 04:47:48

Thank you Spacegaier The code is perfect.It helped me to create a cloth.
Also I now know that a string can be passed in the constructor for many params class. :D

Vineeth@nxOgre

17-03-2008 05:38:51

Hi Spacegaier look at this code .I have added additional peice to your code for creating a cloth pressure as in ageia
1.Cube.1m.mesh
and Cloth pressure


NxOgre::ClothParams cp("mesh-material: nx.flag, density: 0.15, thickness: 0.2, blending-stiffness: 0.7, friction: 0.25, width: 2, height: 3");
cp.flags |= NX_CLF_BENDING;
cp.flags |= NX_CLF_HARDWARE;
cp.flags |= NX_CLF_COLLISION_TWOWAY;

cp.flags|=NX_CLF_PRESSURE;
cp.pressure=2.0f;

NxOgre::Cloth *cloth = mScene->createCloth("cloth", "cube.1m.mesh" ,NxOgre::Pose(Vector3(0,10,0)), cp);


it is crashing what do you think is the solution :x

In Physx i usually would read in the .obj files.
I have also read the thread were they have differentiated why mesh file of a cube and obj of the same are different

It fails during memcpy while in the _createmesh() function

spacegaier

17-03-2008 12:36:58

I can't really help you at the moment for two reasons:

1. I have to learn as I'm writing my final exams in two weeks (that is the smallest problem).

2. I almost have no experiences with cloths (in fact I first looked at them because of your cloth thread). However, I think I have found your problem: In the AGEI PhsyX SDK documentation it says something like the meshes have to be cooked. I don't know whether NxOgre is doing this for you, so I would advise you to just try it in PhsyX code (to do so, just add the following line: #include <NxPhysics.h>, then you be able to directly use PhsyX code in your app. Try to cook a mesh with the help of the PhsyX docu.

Also look at this: http://www.ogre3d.org/phpBB2addons/view ... =165#25879
There it says closed mesh, what ever that will mean (betajaen?).

In my learning breaks I'll probably take a look again on this topic.

Vineeth@nxOgre

17-03-2008 12:48:57

All the very best for your exams

Yeah I will surely look into that and duly reply you back

betajaen

17-03-2008 12:54:09

The cloth class there makes and cooks everything for you. Surprisingly how complicated the code is - it's quite stable.

So I would ask to start off; Do you have the NxCooking.dll in the same directory as the NxOgre one?

spacegaier

17-03-2008 14:35:04

Yes, it is in the same directory.

betajaen: What is meant by closed mesh? What attributes does the mesh have to have?

betajaen

17-03-2008 15:06:05

Closed meshes are basically ones without any holes. Such as a sphere or a cube, open meshes would be a plane, or a football field.

I would make sure normal cloth works before you play around with the pressurised kind.

Vineeth@nxOgre

19-03-2008 07:18:23

Hi Spacegaeir I created the pressurized cloth.

But no matter what amount of pressure i set the ball does not bounce