22 #ifndef _BULLETBOXSHAPE_HH_
23 #define _BULLETBOXSHAPE_HH_
53 if (_size.
x < 0 || _size.
y < 0 || _size.
z < 0)
55 gzerr <<
"Box shape does not support negative size\n";
64 gzwarn <<
"Setting box shape's x to zero \n";
69 gzwarn <<
"Setting box shape's y to zero \n";
74 gzwarn <<
"Setting box shape's z to zero \n";
81 this->collisionParent);
87 this->initialSize = size;
88 bParent->SetCollisionShape(
new btBoxShape(
89 btVector3(size.
x*0.5, size.
y*0.5, size.
z*0.5)));
93 btVector3 boxScale = shape->getLocalScaling();
94 boxScale.setX(size.
x / this->initialSize.x);
95 boxScale.setY(size.
y / this->initialSize.y);
96 boxScale.setZ(size.
z / this->initialSize.z);
98 shape->setLocalScaling(boxScale);
108 if (bLink->GetBulletLink()->getCollisionShape()->isCompound())
110 btCompoundShape *compoundShape =
111 dynamic_cast<btCompoundShape *
>(
112 bLink->GetBulletLink()->getCollisionShape());
114 compoundShape->removeChildShape(shape);
116 this->collisionParent->GetRelativePose();
117 relativePose.
pos -= bLink->GetInertial()->GetCoG();
118 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
virtual ~BulletBoxShape()
Destructor.
Definition: BulletBoxShape.hh:48
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
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:311
#define gzwarn
Output a warning message.
Definition: Console.hh:46
double z
Z location.
Definition: Vector3.hh:317
#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
Bullet wrapper forward declarations and typedefs.
void SetSize(const math::Vector3 &_size)
Set the size of the box.
Definition: BulletBoxShape.hh:51
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:252
void ClearCollisionCache()
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition: BulletTypes.hh:41
Bullet box collision.
Definition: BulletBoxShape.hh:42
BulletBoxShape(CollisionPtr _parent)
Constructor.
Definition: BulletBoxShape.hh:45
double y
Y location.
Definition: Vector3.hh:314