BulletPlaneShape.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012 Open Source Robotics Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16*/
17#ifndef GAZEBO_PHYSICS_BULLET_BULLETPLANESHAPE_HH_
18#define GAZEBO_PHYSICS_BULLET_BULLETPLANESHAPE_HH_
19
20#include <iostream>
21
25#include "gazebo/util/system.hh"
26
27namespace gazebo
28{
29 namespace physics
30 {
34
36 class GZ_PHYSICS_VISIBLE BulletPlaneShape : public PlaneShape
37 {
39 public: explicit BulletPlaneShape(CollisionPtr _parent)
40 : PlaneShape(_parent) {}
41
43 public: virtual ~BulletPlaneShape() {}
44
46 public: void SetAltitude(const ignition::math::Vector3d &pos)
47 {
48 PlaneShape::SetAltitude(pos);
49 }
50
52 public: void CreatePlane()
53 {
54 PlaneShape::CreatePlane();
55 BulletCollisionPtr bParent;
56 bParent = boost::dynamic_pointer_cast<BulletCollision>(
57 this->collisionParent);
58
59 ignition::math::Vector3d n = this->Normal();
60 btVector3 vec(n.X(), n.Y(), n.Z());
61
62 bParent->SetCollisionShape(new btStaticPlaneShape(vec, 0.0),
63 false);
64 }
65 };
67 }
68}
69#endif
Bullet collision for an infinite plane.
Definition BulletPlaneShape.hh:37
void CreatePlane()
Create the plane.
Definition BulletPlaneShape.hh:52
BulletPlaneShape(CollisionPtr _parent)
Constructor.
Definition BulletPlaneShape.hh:39
void SetAltitude(const ignition::math::Vector3d &pos)
Set the altitude of the plane.
Definition BulletPlaneShape.hh:46
virtual ~BulletPlaneShape()
Destructor.
Definition BulletPlaneShape.hh:43
Collision for an infinite plane.
Definition PlaneShape.hh:38
virtual void SetAltitude(const ignition::math::Vector3d &_pos)
Set the altitude of the plane.
ignition::math::Vector3d Normal() const
Get the plane normal.
virtual void CreatePlane()
Create the plane.
CollisionPtr collisionParent
This shape's collision parent.
Definition Shape.hh:73
boost::shared_ptr< BulletCollision > BulletCollisionPtr
Definition BulletTypes.hh:41
boost::shared_ptr< Collision > CollisionPtr
Definition PhysicsTypes.hh:113
Forward declarations for the common classes.
Definition Animation.hh:27