Panda3D
|
00001 // Filename: collisionHandlerPusher.h 00002 // Created by: drose (16Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef COLLISIONHANDLERPUSHER_H 00016 #define COLLISIONHANDLERPUSHER_H 00017 00018 #include "pandabase.h" 00019 00020 #include "collisionHandlerPhysical.h" 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // Class : CollisionHandlerPusher 00024 // Description : A specialized kind of CollisionHandler that simply 00025 // pushes back on things that attempt to move into solid 00026 // walls. This is the simplest kind of "real-world" 00027 // collisions you can have. 00028 //////////////////////////////////////////////////////////////////// 00029 class EXPCL_PANDA_COLLIDE CollisionHandlerPusher : public CollisionHandlerPhysical { 00030 PUBLISHED: 00031 CollisionHandlerPusher(); 00032 virtual ~CollisionHandlerPusher(); 00033 00034 INLINE void set_horizontal(bool flag); 00035 INLINE bool get_horizontal() const; 00036 00037 protected: 00038 virtual bool handle_entries(); 00039 virtual void apply_net_shove( 00040 ColliderDef &def, const LVector3 &net_shove, 00041 const LVector3 &force_normal); 00042 virtual void apply_linear_force(ColliderDef &def, const LVector3 &force); 00043 00044 bool _horizontal; 00045 00046 00047 public: 00048 static TypeHandle get_class_type() { 00049 return _type_handle; 00050 } 00051 static void init_type() { 00052 CollisionHandlerPhysical::init_type(); 00053 register_type(_type_handle, "CollisionHandlerPusher", 00054 CollisionHandlerPhysical::get_class_type()); 00055 } 00056 virtual TypeHandle get_type() const { 00057 return get_class_type(); 00058 } 00059 virtual TypeHandle force_init_type() {init_type(); return get_class_type();} 00060 00061 private: 00062 static TypeHandle _type_handle; 00063 }; 00064 00065 #include "collisionHandlerPusher.I" 00066 00067 #endif 00068 00069 00070