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  void write_datagram(Datagram &destination) const;
38  void read_datagram(DatagramIterator &source);
39 
40 protected:
41  virtual bool handle_entries();
42  virtual void apply_net_shove(
43  ColliderDef &def, const LVector3 &net_shove,
44  const LVector3 &force_normal);
45  virtual void apply_linear_force(ColliderDef &def, const LVector3 &force);
46 
47  bool _horizontal;
48 
49 
50 public:
51  static TypeHandle get_class_type() {
52  return _type_handle;
53  }
54  static void init_type() {
55  CollisionHandlerPhysical::init_type();
56  register_type(_type_handle, "CollisionHandlerPusher",
57  CollisionHandlerPhysical::get_class_type());
58  }
59  virtual TypeHandle get_type() const {
60  return get_class_type();
61  }
62  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
63 
64 private:
65  static TypeHandle _type_handle;
66 };
67 
68 #include "collisionHandlerPusher.I"
69 
70 #endif
void read_datagram(DatagramIterator &source)
Restores the object state from the given datagram, previously obtained using __getstate__.
void write_datagram(Datagram &destination) const
Serializes this object, to implement pickle support.
The abstract base class for a number of CollisionHandlers that have some physical effect on their mov...
A specialized kind of CollisionHandler that simply pushes back on things that attempt to move into so...
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
Definition: datagram.h:38
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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