MCPcopy Create free account
hub / github.com/dartsim/dart / createSoftBody

Function createSoftBody

tutorials/tutorial_collisions_finished/main.cpp:539–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

537}
538
539SkeletonPtr 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
563SkeletonPtr createHybridBody()
564{

Callers 1

mainFunction · 0.70

Calls 7

setMomentMethod · 0.80
setInertiaMethod · 0.80
setAllColorsFunction · 0.70
setMassMethod · 0.45
getVolumeMethod · 0.45
computeInertiaMethod · 0.45
getMassMethod · 0.45

Tested by

no test coverage detected