Remove a Skeleton and get rid of the constraint that was associated with it, if one existed
| 227 | /// Remove a Skeleton and get rid of the constraint that was associated with |
| 228 | /// it, if one existed |
| 229 | void removeSkeleton(const SkeletonPtr& skel) |
| 230 | { |
| 231 | for (std::size_t i = 0; i < mJointConstraints.size(); ++i) { |
| 232 | const dart::constraint::DynamicJointConstraintPtr& constraint |
| 233 | = mJointConstraints[i]; |
| 234 | |
| 235 | if (constraint->getBodyNode1()->getSkeleton() == skel |
| 236 | || constraint->getBodyNode2()->getSkeleton() == skel) { |
| 237 | mWorld->getConstraintSolver()->removeConstraint(constraint); |
| 238 | mJointConstraints.erase(mJointConstraints.begin() + i); |
| 239 | break; // There should only be one constraint per skeleton |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | mWorld->removeSkeleton(skel); |
| 244 | } |
| 245 | |
| 246 | /// Flag to keep track of whether or not we are randomizing the tosses |
| 247 | bool mRandomize; |