Add a ring to the world, and create a BallJoint constraint to ensure that it stays in a ring shape
| 266 | /// Add a ring to the world, and create a BallJoint constraint to ensure that |
| 267 | /// it stays in a ring shape |
| 268 | void addRing(const SkeletonPtr& ring) |
| 269 | { |
| 270 | setupRing(ring); |
| 271 | |
| 272 | if (!addObject(ring)) |
| 273 | return; |
| 274 | |
| 275 | // Create a closed loop to turn the chain into a ring |
| 276 | BodyNode* head = ring->getBodyNode(0); |
| 277 | BodyNode* tail = ring->getBodyNode(ring->getNumBodyNodes() - 1); |
| 278 | |
| 279 | // Compute the offset where the JointConstraint should be located |
| 280 | Eigen::Vector3d offset = Eigen::Vector3d(0, 0, default_shape_height / 2.0); |
| 281 | offset = tail->getWorldTransform() * offset; |
| 282 | auto constraint = std::make_shared<dart::constraint::BallJointConstraint>( |
| 283 | head, tail, offset); |
| 284 | |
| 285 | mWorld->getConstraintSolver()->addConstraint(constraint); |
| 286 | mJointConstraints.push_back(constraint); |
| 287 | } |
| 288 | |
| 289 | /// Remove a Skeleton and get rid of the constraint that was associated with |
| 290 | /// it, if one existed |
nothing calls this directly
no test coverage detected