17 #ifndef GAZEBO_PHYSICS_BULLET_BULLETBOXSHAPE_HH_
18 #define GAZEBO_PHYSICS_BULLET_BULLETBOXSHAPE_HH_
46 public:
void SetSize(
const ignition::math::Vector3d &_size)
48 if (_size.X() < 0 || _size.Y() < 0 || _size.Z() < 0)
50 gzerr <<
"Box shape does not support negative size\n";
53 ignition::math::Vector3d size = _size;
54 if (ignition::math::equal(size.X(), 0.0))
59 gzwarn <<
"Setting box shape's x to zero \n";
62 if (ignition::math::equal(size.Y(), 0.0))
64 gzwarn <<
"Setting box shape's y to zero \n";
67 if (ignition::math::equal(size.Z(), 0.0))
69 gzwarn <<
"Setting box shape's z to zero \n";
76 this->collisionParent);
82 this->initialSize = size;
83 bParent->SetCollisionShape(
new btBoxShape(
84 btVector3(size.X()*0.5, size.Y()*0.5, size.Z()*0.5)));
88 btVector3 boxScale = shape->getLocalScaling();
89 boxScale.setX(size.X() / this->initialSize.X());
90 boxScale.setY(size.Y() / this->initialSize.Y());
91 boxScale.setZ(size.Z() / this->initialSize.Z());
93 shape->setLocalScaling(boxScale);
103 if (bLink->GetBulletLink()->getCollisionShape()->isCompound())
105 btCompoundShape *compoundShape =
106 dynamic_cast<btCompoundShape *
>(
107 bLink->GetBulletLink()->getCollisionShape());
109 compoundShape->removeChildShape(shape);
110 ignition::math::Pose3d relativePose =
111 this->collisionParent->RelativePose()
112 - bLink->GetInertial()->Pose();
113 compoundShape->addChildShape(
120 private: ignition::math::Vector3d initialSize;
Bullet collisions.
Definition: BulletCollision.hh:43
Bullet Link class.
Definition: BulletLink.hh:37
BulletBoxShape(CollisionPtr _parent)
Constructor.
Definition: BulletBoxShape.hh:40
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
virtual void SetSize(const math::Vector3 &_size) GAZEBO_DEPRECATED(8.0)
Set the size of the box.
Bullet wrapper forward declarations and typedefs.
boost::shared_ptr< BulletLink > BulletLinkPtr
Definition: BulletTypes.hh:45
virtual ~BulletBoxShape()
Destructor.
Definition: BulletBoxShape.hh:43
void SetSize(const ignition::math::Vector3d &_size)
Set the size of the box.
Definition: BulletBoxShape.hh:46
Box geometry primitive.
Definition: BoxShape.hh:34
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
Bullet box collision.
Definition: BulletBoxShape.hh:37
void ClearCollisionCache()
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113