51 gzerr <<
"Sphere shape does not support negative radius\n";
54 if (ignition::math::equal(_radius, 0.0))
59 gzwarn <<
"Setting sphere shape's radius to zero \n";
63 SphereShape::SetRadius(_radius);
65 bParent = boost::dynamic_pointer_cast<BulletCollision>(
66 this->collisionParent);
68 btCollisionShape *shape = bParent->GetCollisionShape();
72 ignition::math::Vector3d(_radius, _radius, _radius);
73 bParent->SetCollisionShape(
new btSphereShape(_radius));
77 btVector3 sphereScale;
78 sphereScale.setX(_radius / this->initialSize.X());
79 sphereScale.setY(_radius / this->initialSize.Y());
80 sphereScale.setZ(_radius / this->initialSize.Z());
82 shape->setLocalScaling(sphereScale);
87 boost::dynamic_pointer_cast<BulletLink>(
89 bLink->ClearCollisionCache();
92 if (bLink->GetBulletLink()->getCollisionShape()->isCompound())
94 btCompoundShape *compoundShape =
95 dynamic_cast<btCompoundShape *
>(
96 bLink->GetBulletLink()->getCollisionShape());
98 compoundShape->removeChildShape(shape);
99 ignition::math::Pose3d relativePose =
100 this->collisionParent->RelativePose()
101 - bLink->GetInertial()->Pose();
102 compoundShape->addChildShape(
103 BulletTypes::ConvertPose(relativePose), shape);