22 #ifndef _BULLETBOXSHAPE_HH_
23 #define _BULLETBOXSHAPE_HH_
50 if (_size.
x < 0 || _size.
y < 0 || _size.
z < 0)
52 gzerr <<
"Box shape does not support negative size\n";
61 gzwarn <<
"Setting box shape's x to zero \n";
66 gzwarn <<
"Setting box shape's y to zero \n";
71 gzwarn <<
"Setting box shape's z to zero \n";
78 this->collisionParent);
84 this->initialSize = size;
85 bParent->SetCollisionShape(
new btBoxShape(
86 btVector3(size.
x*0.5, size.
y*0.5, size.
z*0.5)));
90 btVector3 boxScale = shape->getLocalScaling();
91 boxScale.setX(size.
x / this->initialSize.x);
92 boxScale.setY(size.
y / this->initialSize.y);
93 boxScale.setZ(size.
z / this->initialSize.z);
95 shape->setLocalScaling(boxScale);
105 if (bLink->GetBulletLink()->getCollisionShape()->isCompound())
107 btCompoundShape *compoundShape =
108 dynamic_cast<btCompoundShape *
>(
109 bLink->GetBulletLink()->getCollisionShape());
111 compoundShape->removeChildShape(shape);
113 this->collisionParent->GetRelativePose();
114 relativePose.
pos -= bLink->GetInertial()->GetCoG();
115 compoundShape->addChildShape(
Bullet collisions.
Definition: BulletCollision.hh:53
boost::shared_ptr< BulletLink > BulletLinkPtr
Definition: BulletTypes.hh:44
Bullet Link class.
Definition: BulletLink.hh:44
virtual ~BulletBoxShape()
Destructor.
Definition: BulletBoxShape.hh:45
Encapsulates a position and rotation in three space.
Definition: Pose.hh:40
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:43
btCollisionShape * GetCollisionShape() const
Get the bullet collision shape.
virtual void SetSize(const math::Vector3 &_size)
Set the size of the box.
double x
X location.
Definition: Vector3.hh:302
#define gzwarn
Output a warning message.
Definition: Console.hh:46
double z
Z location.
Definition: Vector3.hh:308
#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:168
boost::shared_ptr< Collision > CollisionPtr
Definition: PhysicsTypes.hh:94
void SetSize(const math::Vector3 &_size)
Set the size of the box.
Definition: BulletBoxShape.hh:48
Box geometry primitive.
Definition: BoxShape.hh:37
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:243
void ClearCollisionCache()
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:41
Bullet box collision.
Definition: BulletBoxShape.hh:39
BulletBoxShape(CollisionPtr _parent)
Constructor.
Definition: BulletBoxShape.hh:42
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48
double y
Y location.
Definition: Vector3.hh:305