vrsode/include/vrsode/CollisionBody.h

Go to the documentation of this file.
00001 
00002 #ifndef _VRSODE_COLLISION_BODY_H_
00003 #define _VRSODE_COLLISION_BODY_H_
00004 
00005 #include <ode/ode.h>
00006 #include <vrs/sharedobj.h>
00007 #include <vrs/matrix.h>
00008 
00009 #include "CollisionShape.h"
00010 #include "SceneNodeLock.h"
00011 #include "Shape.h"
00012 #include "Surface.h"
00013 
00014 namespace VRS
00015 {
00016     class SceneThing;
00017     class Translation;
00018     class Rotation;
00019     class Shape;
00020 }
00021 
00022 namespace vrsode
00023 {
00024 
00026 static const unsigned long COLLISION_CAT_STATIC_WORLD = 1;
00027 
00029 static const unsigned long COLLISION_CAT_DYNAMIC_OBJS = 2;
00030 
00034 class CollisionBody : public VRS::SharedObj
00035 {
00036     VRS::SO<VRS::SceneThing> m_sceneThing;
00037 
00038     VRS::SO<VRS::Translation> m_translation;
00039     VRS::SO<VRS::Rotation> m_rotation;
00040 
00041     VRS::SO<VRS::Shape> m_vrsShape;
00042     
00043     dGeomID m_geomId;
00044     CollisionShape m_collisionShape;
00045 
00046     VRS::SO<Surface> m_surface;
00047     VRS::SO<Shape> m_odeShape;
00048 
00049     VRS::SO<SceneNodeLock> m_sceneNodeLock;
00050 
00051     bool m_reportCollision;
00052 
00053     bool m_cleanedUp;
00054     
00055     bool m_wantToDestroy;
00056 
00057 protected:
00058     void setupTransformationNodes();
00059     void insertLocker();
00060 
00061     bool cleanedUp();
00062     void setCleanedUp(bool);
00063 
00064 public:
00069     CollisionBody(VRS::SO<VRS::SceneThing>, CollisionShape, bool = true);
00070 
00075     CollisionBody(VRS::SO<VRS::SceneThing>, VRS::SO<Shape>, bool = true);
00076 
00080     virtual ~CollisionBody();
00081 
00086     VRS::SO<VRS::SceneThing> sceneThing() const;
00087 
00092     const dGeomID geomId() const;
00093 
00099     const CollisionShape collisionShape() const;
00100 
00106     virtual void setDebugNode(bool = true);
00107 
00112     const VRS::Vector position() const;
00113 
00120     void setPosition(VRS::Vector);
00121 
00126     void setPosition(double, double, double);
00127 
00132     const VRS::Matrix& rotation() const;
00133 
00140     void setRotation(VRS::Vector, double);
00141 
00146     void setRotation(double, double, double, double);
00147 
00154     VRS::SO<VRS::Translation> translationNode();
00155 
00162     VRS::SO<VRS::Rotation> rotationNode();
00163 
00169     VRS::SO<VRS::Shape> vrsShape();
00170 
00176     virtual void syncTransformationsToODE();
00177 
00185     virtual void handleCollision(VRS::SO<CollisionBody>);
00186 
00190     void setSurface(VRS::SO<Surface>);
00191 
00195     VRS::SO<Surface> surface();
00196 
00200     VRS::SO<Shape> odeShape();
00201 
00205     bool debugNode();
00206 
00210     void setCollisionCategory(unsigned int);
00211 
00215     unsigned int collisionCategory();
00216 
00220     void setCollisionPartnerCategories(unsigned int);
00221 
00225     unsigned int collisionPartnerCategories();
00226 
00230     VRS::SO<SceneNodeLock> sceneNodeLock();
00231 
00235     void setReportCollision(bool);
00236     
00240     virtual void destroy();
00241     
00245     void wantToDestroy();
00246 
00250     virtual void update();
00251     
00255     bool wantsToGetDestroyed();
00256 };
00257 
00258 }
00259 
00260 #endif

Generated on Fri May 11 21:01:58 2007 for Random Racer by  doxygen 1.5.1