| 561 | } |
| 562 | |
| 563 | SkeletonPtr createHybridBody() |
| 564 | { |
| 565 | SkeletonPtr hybrid = Skeleton::create("hybrid"); |
| 566 | |
| 567 | // Add a soft body |
| 568 | BodyNode* bn = addSoftBody<FreeJoint>(hybrid, "soft sphere", SOFT_ELLIPSOID); |
| 569 | |
| 570 | // Add a rigid body attached by a WeldJoint |
| 571 | bn = hybrid->createJointAndBodyNodePair<WeldJoint>(bn).second; |
| 572 | bn->setName("rigid box"); |
| 573 | |
| 574 | double box_shape_height = default_shape_height; |
| 575 | std::shared_ptr<BoxShape> box |
| 576 | = std::make_shared<BoxShape>(box_shape_height * Eigen::Vector3d::Ones()); |
| 577 | bn->createShapeNodeWith<VisualAspect, CollisionAspect, DynamicsAspect>(box); |
| 578 | |
| 579 | Eigen::Isometry3d tf(Eigen::Isometry3d::Identity()); |
| 580 | tf.translation() = Eigen::Vector3d(box_shape_height / 2.0, 0, 0); |
| 581 | bn->getParentJoint()->setTransformFromParentBodyNode(tf); |
| 582 | |
| 583 | Inertia inertia; |
| 584 | inertia.setMass(default_shape_density * box->getVolume()); |
| 585 | inertia.setMoment(box->computeInertia(inertia.getMass())); |
| 586 | bn->setInertia(inertia); |
| 587 | |
| 588 | setAllColors(hybrid, dart::Color::Green()); |
| 589 | |
| 590 | return hybrid; |
| 591 | } |
| 592 | |
| 593 | SkeletonPtr createGround() |
| 594 | { |
no test coverage detected