17 #ifndef GAZEBO_PHYSICS_BULLET_BULLETSPHERESHAPE_HH_ 18 #define GAZEBO_PHYSICS_BULLET_BULLETSPHERESHAPE_HH_ 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";
66 this->collisionParent);
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);
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(
109 private: ignition::math::Vector3d initialSize;
Bullet collisions.
Definition: BulletCollision.hh:43
Bullet Link class.
Definition: BulletLink.hh:37
static btTransform ConvertPose(const ignition::math::Pose3d &_pose)
Convert an ignition math pose to a bullet transform.
Definition: BulletTypes.hh:111
Forward declarations for the common classes.
Definition: Animation.hh:26
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:39
#define gzwarn
Output a warning message.
Definition: Console.hh:47
btCollisionShape * GetCollisionShape() const
Get the bullet collision shape.
#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:42
virtual ~BulletSphereShape()
Destructor.
Definition: BulletSphereShape.hh:43
void SetRadius(double _radius)
Set the radius.
Definition: BulletSphereShape.hh:47
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