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

Function createWall

tutorials/tutorial_collisions_finished/main.cpp:609–632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607}
608
609SkeletonPtr createWall()
610{
611 SkeletonPtr wall = Skeleton::create("wall");
612
613 BodyNode* bn = wall->createJointAndBodyNodePair<WeldJoint>().second;
614
615 std::shared_ptr<BoxShape> shape = std::make_shared<BoxShape>(Eigen::Vector3d(
616 default_wall_thickness, default_ground_width, default_wall_height));
617 auto shapeNode
618 = bn->createShapeNodeWith<VisualAspect, CollisionAspect, DynamicsAspect>(
619 shape);
620 shapeNode->getVisualAspect()->setColor(Eigen::Vector3d(0.8, 0.8, 0.8));
621
622 Eigen::Isometry3d tf(Eigen::Isometry3d::Identity());
623 tf.translation() = Eigen::Vector3d(
624 (default_ground_width + default_wall_thickness) / 2.0,
625 0.0,
626 (default_wall_height - default_wall_thickness) / 2.0);
627 bn->getParentJoint()->setTransformFromParentBodyNode(tf);
628
629 shapeNode->getDynamicsAspect()->setRestitutionCoeff(0.2);
630
631 return wall;
632}
633
634int main(int argc, char* argv[])
635{

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