00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- 00002 00003 this file is part of rcssserver3D 00004 Fri May 9 2003 00005 Copyright (C) 2002,2003 Koblenz University 00006 Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group 00007 $Id: collider.h,v 1.10 2004/04/15 14:19:04 rollmark Exp $ 00008 00009 This program is free software; you can redistribute it and/or modify 00010 it under the terms of the GNU General Public License as published by 00011 the Free Software Foundation; version 2 of the License. 00012 00013 This program is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00021 */ 00022 #ifndef OXYGEN_COLLIDER_H 00023 #define OXYGEN_COLLIDER_H 00024 00025 #include "odeobject.h" 00026 #include <string> 00027 00028 namespace oxygen 00029 { 00030 class Space; 00031 class World; 00032 00043 class Collider : public ODEObject 00044 { 00045 // 00046 // Functions 00047 // 00048 public: 00052 enum ECollisionType 00053 { 00055 CT_DIRECT, 00056 00058 CT_SYMMETRIC 00059 }; 00060 00061 public: 00062 Collider(); 00063 virtual ~Collider(); 00064 00081 virtual void OnCollision (boost::shared_ptr<Collider> collidee, 00082 dContact& contact, ECollisionType type); 00083 00090 bool AddCollisionHandler(const std::string& handlerName); 00091 00093 static boost::shared_ptr<Collider> GetCollider(dGeomID id); 00094 00096 dGeomID GetODEGeom(); 00097 00102 virtual void SetPosition(const salt::Vector3f& pos); 00103 00108 virtual void SetRotation(const salt::Matrix& rot); 00109 00113 bool Intersects(boost::shared_ptr<Collider> collider); 00114 00115 protected: 00119 virtual void OnLink(); 00120 00124 virtual void OnUnlink(); 00125 00129 virtual void PrePhysicsUpdateInternal(float deltaTime); 00130 00131 // 00132 // Members 00133 // 00134 protected: 00136 dGeomID mODEGeom; 00137 }; 00138 00139 DECLARE_CLASS(Collider); 00140 00141 } //namespace oxygen 00142 00143 #endif //OXYGEN_COLLIDER_H