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

Function createWall

tutorials/tutorial_collisions/main.cpp:438–461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436}
437
438SkeletonPtr createWall()
439{
440 SkeletonPtr wall = Skeleton::create("wall");
441
442 BodyNode* bn = wall->createJointAndBodyNodePair<WeldJoint>().second;
443
444 std::shared_ptr<BoxShape> shape = std::make_shared<BoxShape>(Eigen::Vector3d(
445 default_wall_thickness, default_ground_width, default_wall_height));
446 auto shapeNode
447 = bn->createShapeNodeWith<VisualAspect, CollisionAspect, DynamicsAspect>(
448 shape);
449 shapeNode->getVisualAspect()->setColor(Eigen::Vector3d(0.8, 0.8, 0.8));
450
451 Eigen::Isometry3d tf(Eigen::Isometry3d::Identity());
452 tf.translation() = Eigen::Vector3d(
453 (default_ground_width + default_wall_thickness) / 2.0,
454 0.0,
455 (default_wall_height - default_wall_thickness) / 2.0);
456 bn->getParentJoint()->setTransformFromParentBodyNode(tf);
457
458 shapeNode->getDynamicsAspect()->setRestitutionCoeff(0.2);
459
460 return wall;
461}
462
463int main(int argc, char* argv[])
464{

Callers 1

mainFunction · 0.70

Calls 5

getVisualAspectMethod · 0.80
getParentJointMethod · 0.80
setRestitutionCoeffMethod · 0.80
setColorMethod · 0.45

Tested by

no test coverage detected