Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool hasStatus = true;
- m_data->m_softBodyWorldInfo.m_broadphase = m_data->m_broadphase;
- m_data->m_softBodyWorldInfo.m_sparsesdf.Initialize();
- const btScalar spawnX = 0;
- const btScalar spawnHeight = 1;
- const btScalar spawnZ = 0;
- const btVector3 centerOfCloth = btVector3(spawnX, spawnHeight, spawnZ);
- const int numX = 100;
- const int numY = 100;
- const int noFixedCorners = 0;
- const int pinAllFourCornerVertices = 1+2+4+8;
- const int fixed = pinAllFourCornerVertices;
- const double mass = 0.01;
- btSoftBody *cloth = btSoftBodyHelpers::CreatePatch(m_data->m_softBodyWorldInfo,
- btVector3(centerOfCloth.x() ,spawnHeight + 1, centerOfCloth.z() - 1),
- btVector3(centerOfCloth.x() ,spawnHeight - 1, centerOfCloth.z() - 1),
- btVector3(centerOfCloth.x() ,spawnHeight + 1, centerOfCloth.z() + 1),
- btVector3(centerOfCloth.x() ,spawnHeight - 1, centerOfCloth.z() + 1),
- numX, numY,
- fixed, true);
- cloth->m_materials[0]->m_kLST = 0.4;
- cloth->m_cfg.collisions |= btSoftBody::fCollision::VF_SS;
- cloth->setTotalMass(mass);
- cloth->rotate(btQuaternion(0.70711, 0, 0, 0.70711));
- cloth->scale(btVector3(0.2, 0.2, 0.2));
- cloth->randomizeConstraints();
- const btScalar bulletDefaultMargin = 0.03;
- const btScalar blenderDefaultMargin = 0.03;
- cloth->getCollisionShape()->setMargin(blenderDefaultMargin);
- m_data->m_softBodyWorldInfo.air_density = (btScalar) 1.2;
- m_data->m_softBodyWorldInfo.water_density = 0;
- m_data->m_softBodyWorldInfo.water_offset = 0;
- m_data->m_softBodyWorldInfo.water_normal = btVector3(0, 0, 0);
- btVector3 currentGravity = m_data->m_dynamicsWorld->getGravity();
- m_data->m_softBodyWorldInfo.m_gravity.setValue(currentGravity.x(), currentGravity.y(), currentGravity.z());
- cloth->m_cfg.piterations = 5;
- cloth->m_cfg.citerations = 5;
- cloth->m_cfg.diterations = 5;
- cloth->m_cfg.kDP = 0.005f;
- // cloth->m_cfg.kDP; // Damping coefficient [0,1]
- // cloth->m_cfg.kDG = 100.0f; // Drag coefficient [0,+inf]
- // cloth->m_cfg.kLF; // Lift coefficient [0,+inf]
- // cloth->m_cfg.kPR; // Pressure coefficient [-inf,+inf]
- // cloth->m_cfg.kVC; // Volume conversation coefficient [0,+inf]
- cloth->m_cfg.kDF = 1.0f; // Dynamic friction coefficient [0,1]
- // cloth->m_cfg.kMT; // Pose matching coefficient [0,1]
- // cloth->m_cfg.kCHR; // Rigid contacts hardness [0,1]
- // cloth->m_cfg.kKHR; // Kinetic contacts hardness [0,1]
- // cloth->m_cfg.kSHR; // Soft contacts hardness [0,1]
- // cloth->m_cfg.kAHR; // Anchors hardness [0,1]
- // cloth->m_cfg.kSRHR_CL; // Soft vs rigid hardness [0,1] (cluster only)
- // cloth->m_cfg.kSKHR_CL; // Soft vs kinetic hardness [0,1] (cluster only)
- // cloth->m_cfg.kSSHR_CL;
- m_data->m_dynamicsWorld->addSoftBody(cloth);
- serverStatusOut.m_type = CMD_CLIENT_COMMAND_COMPLETED;
- return hasStatus;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement