17 #ifndef _GAZEBO_BULLETBOXSHAPE_HH_
18 #define _GAZEBO_BULLETBOXSHAPE_HH_
48 if (_size.
x < 0 || _size.
y < 0 || _size.
z < 0)
50 gzerr <<
"Box shape does not support negative size\n";
59 gzwarn <<
"Setting box shape's x to zero \n";
64 gzwarn <<
"Setting box shape's y to zero \n";
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);
111 this->collisionParent->GetRelativePose();
112 relativePose.
pos -= bLink->GetInertial()->GetCoG();
113 compoundShape->addChildShape(
double x
X location.
Definition: Vector3.hh:311
Bullet collisions.
Definition: BulletCollision.hh:53
Bullet Link class.
Definition: BulletLink.hh:42
double y
Y location.
Definition: Vector3.hh:314
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
BulletBoxShape(CollisionPtr _parent)
Constructor.
Definition: BulletBoxShape.hh:40
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:40
#define gzwarn
Output a warning message.
Definition: Console.hh:47
#define gzerr
Output an error message.
Definition: Console.hh:50
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
double z
Z location.
Definition: Vector3.hh:317
Bullet wrapper forward declarations and typedefs.
static math::Pose ConvertPose(const btTransform &_bt)
Convert a bullet transform to a gazebo pose.
Definition: BulletTypes.hh:92
void SetSize(const math::Vector3 &_size)
Set the size of the box.
Definition: BulletBoxShape.hh:46
boost::shared_ptr< BulletLink > BulletLinkPtr
Definition: BulletTypes.hh:43
virtual ~BulletBoxShape()
Destructor.
Definition: BulletBoxShape.hh:43
Box geometry primitive.
Definition: BoxShape.hh:37
btCollisionShape * GetCollisionShape() const
Get the bullet collision shape.
Vector3 pos
The position.
Definition: Pose.hh:252
Bullet box collision.
Definition: BulletBoxShape.hh:37
void ClearCollisionCache()
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:113
virtual void SetSize(const math::Vector3 &_size)
Set the size of the box.