17 #ifndef GAZEBO_PHYSICS_BULLET_BULLETSPHERESHAPE_HH_
18 #define GAZEBO_PHYSICS_BULLET_BULLETSPHERESHAPE_HH_
50 gzerr <<
"Sphere shape does not support negative radius\n";
53 if (ignition::math::equal(_radius, 0.0))
58 gzwarn <<
"Setting sphere shape's radius to zero \n";
65 this->collisionParent);
71 ignition::math::Vector3d(_radius, _radius, _radius);
72 bParent->SetCollisionShape(
new btSphereShape(_radius));
76 btVector3 sphereScale;
77 sphereScale.setX(_radius / this->initialSize.X());
78 sphereScale.setY(_radius / this->initialSize.Y());
79 sphereScale.setZ(_radius / this->initialSize.Z());
81 shape->setLocalScaling(sphereScale);
91 if (bLink->GetBulletLink()->getCollisionShape()->isCompound())
93 btCompoundShape *compoundShape =
94 dynamic_cast<btCompoundShape *
>(
95 bLink->GetBulletLink()->getCollisionShape());
97 compoundShape->removeChildShape(shape);
98 ignition::math::Pose3d relativePose =
99 this->collisionParent->RelativePose()
100 - bLink->GetInertial()->Pose();
101 compoundShape->addChildShape(
108 private: ignition::math::Vector3d initialSize;
Bullet collisions.
Definition: BulletCollision.hh:43
Bullet Link class.
Definition: BulletLink.hh:37
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:42
#define gzwarn
Output a warning message.
Definition: Console.hh:47
#define gzerr
Output an error message.
Definition: Console.hh:50
BulletSphereShape(CollisionPtr _parent)
Constructor.
Definition: BulletSphereShape.hh:39
virtual void SetRadius(double _radius)
Set the size.
boost::shared_ptr< BulletLink > BulletLinkPtr
Definition: BulletTypes.hh:45
virtual ~BulletSphereShape()
Destructor.
Definition: BulletSphereShape.hh:42
btCollisionShape * GetCollisionShape() const
Get the bullet collision shape.
static math::Pose ConvertPose(const btTransform &_bt) GAZEBO_DEPRECATED(8.0)
Convert a bullet transform to a gazebo pose.
Definition: BulletTypes.hh:183
void SetRadius(double _radius)
Set the radius.
Definition: BulletSphereShape.hh:46
Bullet sphere collision.
Definition: BulletSphereShape.hh:36
void ClearCollisionCache()
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113
Sphere collision shape.
Definition: SphereShape.hh:39