Once we are done with the creation of the cloth fabric, we will finally create a cloth by calling the PxPhysics::createCloth()
function that requires four parameters. The first parameter is a type of PxTransform,
and it represents the global position of the cloth. The second parameter is a type of PxClothFabric,
and here we will put the reference of the cloth fabric we created before. The third parameter takes the first element of the PxClothParticle
array, which is also used in the mesh description class. The last parameter is a type of PxClothFlags,
and it is used to set the flag to turn the cloth related features on/off such as GPU acceleration and continuous collision detection (CCD).
A typical example for creating a cloth is given in the following code:
PxTransform pose = PxTransform(PxVec3(1.0f)); PxCloth* cloth = gPhysicsSDK->createCloth(pose, fabric, vertices, PxClothFlags()); gScene->addActor(cloth);