[Solved] attaching cloth to an actor

lxcid

03-12-2007 07:18:34

Hi,

I want to create a (cloth) flag that is attached to an capsule (flagpole) like the one shown in the tutorial 1002 ageia physx training program.

I am faced with 2 problems. One is that the flag doesn't seems to attach to the flagpole.

Second is that the pole react to the flag and fall to the ground.

here's the code.


NxOgre::Actor* flagPole = scene_->createActor("flagPole", new NxOgre::CapsuleShape(0.2, 12), NxOgre::Pose(0, -0.2, 0), "density: 0");
NxOgre::ClothParams cp;
cp.setToDefault();
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.meshMaterial = "nx.flag";
cp.width = 8;
cp.height = 8;
cp.density = 0.15;

NxOgre::Cloth* flag = scene_->createCloth("flag", NxOgre::Pose(Ogre::Vector3(0, 4, 0), Ogre::Quaternion(Ogre::Radian(-NxHalfPiF32), Ogre::Vector3::UNIT_X)), cp);
flag->attachToShape(*(flagPole->getNxActor()->getShapes()), NX_CLOTH_ATTACHMENT_TWOWAY);


I want the flag to be attached to the pole but I don't want the flag to react to the pole till it got pushed down to the ground.

Edited: There is no bug in the above code. The only problem with the above code is that I need to make sure that the pole had to be static.