Panda3D
collisionHandlerPusher.h
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file collisionHandlerPusher.h
10  * @author drose
11  * @date 2002-03-16
12  */
13 
14 #ifndef COLLISIONHANDLERPUSHER_H
15 #define COLLISIONHANDLERPUSHER_H
16 
17 #include "pandabase.h"
18 
20 
21 /**
22  * A specialized kind of CollisionHandler that simply pushes back on things
23  * that attempt to move into solid walls. This is the simplest kind of "real-
24  * world" collisions you can have.
25  */
26 class EXPCL_PANDA_COLLIDE CollisionHandlerPusher : public CollisionHandlerPhysical {
27 PUBLISHED:
29  virtual ~CollisionHandlerPusher();
30 
31  INLINE void set_horizontal(bool flag);
32  INLINE bool get_horizontal() const;
33 
34 PUBLISHED:
35  MAKE_PROPERTY(horizontal, get_horizontal, set_horizontal);
36 
37 protected:
38  virtual bool handle_entries();
39  virtual void apply_net_shove(
40  ColliderDef &def, const LVector3 &net_shove,
41  const LVector3 &force_normal);
42  virtual void apply_linear_force(ColliderDef &def, const LVector3 &force);
43 
44  bool _horizontal;
45 
46 
47 public:
48  static TypeHandle get_class_type() {
49  return _type_handle;
50  }
51  static void init_type() {
52  CollisionHandlerPhysical::init_type();
53  register_type(_type_handle, "CollisionHandlerPusher",
54  CollisionHandlerPhysical::get_class_type());
55  }
56  virtual TypeHandle get_type() const {
57  return get_class_type();
58  }
59  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
60 
61 private:
62  static TypeHandle _type_handle;
63 };
64 
65 #include "collisionHandlerPusher.I"
66 
67 #endif
collisionHandlerPusher.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
CollisionHandlerPhysical
The abstract base class for a number of CollisionHandlers that have some physical effect on their mov...
Definition: collisionHandlerPhysical.h:31
CollisionHandlerPusher
A specialized kind of CollisionHandler that simply pushes back on things that attempt to move into so...
Definition: collisionHandlerPusher.h:26
collisionHandlerPhysical.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.