Add API to set bunny properties. Add example to show coupling between softbody and multibody.
This commit is contained in:
@@ -1629,6 +1629,21 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
case CMD_LOAD_BUNNY:
|
||||
{
|
||||
#ifdef USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD
|
||||
double scale = 0.1;
|
||||
double mass = 0.1;
|
||||
double collisionMargin = 0.02;
|
||||
if (clientCmd.m_updateFlags & LOAD_BUNNY_UPDATE_SCALE)
|
||||
{
|
||||
scale = clientCmd.m_loadBunnyArguments.m_scale;
|
||||
}
|
||||
if (clientCmd.m_updateFlags & LOAD_BUNNY_UPDATE_MASS)
|
||||
{
|
||||
mass = clientCmd.m_loadBunnyArguments.m_mass;
|
||||
}
|
||||
if (clientCmd.m_updateFlags & LOAD_BUNNY_UPDATE_COLLISION_MARGIN)
|
||||
{
|
||||
collisionMargin = clientCmd.m_loadBunnyArguments.m_collisionMargin;
|
||||
}
|
||||
m_data->m_softBodyWorldInfo.air_density = (btScalar)1.2;
|
||||
m_data->m_softBodyWorldInfo.water_density = 0;
|
||||
m_data->m_softBodyWorldInfo.water_offset = 0;
|
||||
@@ -1648,9 +1663,9 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
psb->randomizeConstraints();
|
||||
psb->rotate(btQuaternion(0.70711,0,0,0.70711));
|
||||
psb->translate(btVector3(0,0,1.0));
|
||||
psb->scale(btVector3(0.1,0.1,0.1));
|
||||
psb->setTotalMass(0.1,true);
|
||||
psb->getCollisionShape()->setMargin(0.02);
|
||||
psb->scale(btVector3(scale,scale,scale));
|
||||
psb->setTotalMass(mass,true);
|
||||
psb->getCollisionShape()->setMargin(collisionMargin);
|
||||
|
||||
m_data->m_dynamicsWorld->addSoftBody(psb);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user