00001 // Filename: collisionHandlerFloor.h 00002 // Created by: drose (16Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef COLLISIONHANDLERFLOOR_H 00020 #define COLLISIONHANDLERFLOOR_H 00021 00022 #include "pandabase.h" 00023 00024 #include "collisionHandlerPhysical.h" 00025 00026 /////////////////////////////////////////////////////////////////// 00027 // Class : CollisionHandlerFloor 00028 // Description : A specialized kind of CollisionHandler that sets the 00029 // Z height of the collider to a fixed linear offset 00030 // from the highest detected collision point each frame. 00031 // It's intended to implement walking around on a floor 00032 // of varying height by casting a ray down from the 00033 // avatar's head. 00034 //////////////////////////////////////////////////////////////////// 00035 class EXPCL_PANDA CollisionHandlerFloor : public CollisionHandlerPhysical { 00036 PUBLISHED: 00037 CollisionHandlerFloor(); 00038 virtual ~CollisionHandlerFloor(); 00039 00040 INLINE void set_offset(float offset); 00041 INLINE float get_offset() const; 00042 00043 INLINE void set_max_velocity(float max_vel); 00044 INLINE float get_max_velocity() const; 00045 00046 protected: 00047 virtual bool handle_entries(); 00048 00049 private: 00050 float _offset; 00051 float _max_velocity; 00052 00053 00054 public: 00055 static TypeHandle get_class_type() { 00056 return _type_handle; 00057 } 00058 static void init_type() { 00059 CollisionHandlerPhysical::init_type(); 00060 register_type(_type_handle, "CollisionHandlerFloor", 00061 CollisionHandlerPhysical::get_class_type()); 00062 } 00063 virtual TypeHandle get_type() const { 00064 return get_class_type(); 00065 } 00066 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00067 00068 private: 00069 static TypeHandle _type_handle; 00070 }; 00071 00072 #include "collisionHandlerFloor.I" 00073 00074 #endif 00075 00076 00077