| 537 | } |
| 538 | |
| 539 | SkeletonPtr createSoftBody() |
| 540 | { |
| 541 | SkeletonPtr soft = Skeleton::create("soft"); |
| 542 | |
| 543 | // Add a soft body |
| 544 | BodyNode* bn = addSoftBody<FreeJoint>(soft, "soft box", SOFT_BOX); |
| 545 | |
| 546 | // Add a rigid collision geometry and inertia |
| 547 | double width = default_shape_height, height = 2 * default_shape_width; |
| 548 | Eigen::Vector3d dims(width, width, height); |
| 549 | dims *= 0.6; |
| 550 | std::shared_ptr<BoxShape> box = std::make_shared<BoxShape>(dims); |
| 551 | bn->createShapeNodeWith<VisualAspect, CollisionAspect, DynamicsAspect>(box); |
| 552 | |
| 553 | Inertia inertia; |
| 554 | inertia.setMass(default_shape_density * box->getVolume()); |
| 555 | inertia.setMoment(box->computeInertia(inertia.getMass())); |
| 556 | bn->setInertia(inertia); |
| 557 | |
| 558 | setAllColors(soft, dart::Color::Fuchsia()); |
| 559 | |
| 560 | return soft; |
| 561 | } |
| 562 | |
| 563 | SkeletonPtr createHybridBody() |
| 564 | { |
no test coverage detected