22 #ifndef _BULLETSPHERESHAPE_HH_
23 #define _BULLETSPHERESHAPE_HH_
55 gzerr <<
"Sphere shape does not support negative radius\n";
63 gzwarn <<
"Setting sphere shape's radius to zero \n";
70 this->collisionParent);
76 bParent->SetCollisionShape(
new btSphereShape(_radius));
80 btVector3 sphereScale;
81 sphereScale.setX(_radius / this->initialSize.x);
82 sphereScale.setY(_radius / this->initialSize.y);
83 sphereScale.setZ(_radius / this->initialSize.z);
85 shape->setLocalScaling(sphereScale);
95 if (bLink->GetBulletLink()->getCollisionShape()->isCompound())
97 btCompoundShape *compoundShape =
98 dynamic_cast<btCompoundShape *
>(
99 bLink->GetBulletLink()->getCollisionShape());
101 compoundShape->removeChildShape(shape);
103 this->collisionParent->GetRelativePose();
104 relativePose.
pos -= bLink->GetInertial()->GetCoG();
105 compoundShape->addChildShape(
Bullet collisions.
Definition: BulletCollision.hh:53
boost::shared_ptr< BulletLink > BulletLinkPtr
Definition: BulletTypes.hh:44
Bullet Link class.
Definition: BulletLink.hh:44
#define GZ_PHYSICS_VISIBLE
Definition: system.hh:318
Encapsulates a position and rotation in three space.
Definition: Pose.hh:37
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
void SetRadius(double _radius)
Set the radius.
Definition: BulletSphereShape.hh:51
btCollisionShape * GetCollisionShape() const
Get the bullet collision shape.
#define gzwarn
Output a warning message.
Definition: Console.hh:46
BulletSphereShape(CollisionPtr _parent)
Constructor.
Definition: BulletSphereShape.hh:44
#define gzerr
Output an error message.
Definition: Console.hh:49
bool equal(const T &_a, const T &_b, const T &_epsilon=1e-6)
check if two values are equal, within a tolerance
Definition: Helpers.hh:171
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:96
virtual ~BulletSphereShape()
Destructor.
Definition: BulletSphereShape.hh:47
static math::Pose ConvertPose(const btTransform &_bt)
Convert a bullet transform to a gazebo pose.
Definition: BulletTypes.hh:93
Vector3 pos
The position.
Definition: Pose.hh:252
void ClearCollisionCache()
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:41
Bullet sphere collision.
Definition: BulletSphereShape.hh:41
virtual void SetRadius(double _radius)
Set the size.
Sphere collision shape.
Definition: SphereShape.hh:44