Panda3D
 All Classes Functions Variables Enumerations
collisionHandlerHighestEvent.h
1 // Filename: collisionHandlerEvent.h
2 // Created by: drose (16Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef COLLISIONHANDLERHIGHESTEVENT_H
16 #define COLLISIONHANDLERHIGHESTEVENT_H
17 
18 #include "pandabase.h"
19 
20 #include "collisionHandlerEvent.h"
21 #include "collisionNode.h"
22 #include "collisionEntry.h"
23 
24 #include "vector_string.h"
25 #include "pointerTo.h"
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : CollisionHandlerEvent
29 // Description : A specialized kind of CollisionHandler that throws an
30 // event for each collision detected. The event thrown
31 // may be based on the name of the moving object or the
32 // struck object, or both. The first parameter of the
33 // event will be a pointer to the CollisionEntry that
34 // triggered it.
35 ////////////////////////////////////////////////////////////////////
36 class EXPCL_PANDA_COLLIDE CollisionHandlerHighestEvent : public CollisionHandlerEvent {
37 PUBLISHED:
39 
40 public:
41  virtual void begin_group();
42  virtual void add_entry(CollisionEntry *entry);
43  virtual bool end_group();
44 private:
45  double _collider_distance;
46  PT(CollisionEntry) _closest_collider;
47 
48 
49 public:
50  static TypeHandle get_class_type() {
51  return _type_handle;
52  }
53  static void init_type() {
54  CollisionHandler::init_type();
55  register_type(_type_handle, "CollisionHandlerHighestEvent",
56  CollisionHandlerEvent::get_class_type());
57  }
58  virtual TypeHandle get_type() const {
59  return get_class_type();
60  }
61  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
62 
63 private:
64  static TypeHandle _type_handle;
65 };
66 
67 #endif
68 
69 
70 
virtual bool end_group()
Called by the CollisionTraverser at the completion of all collision detections for this traversal...
virtual void begin_group()
Will be called by the CollisionTraverser before a new traversal is begun.
A specialized kind of CollisionHandler that throws an event for each collision detected.
Defines a single collision event.
A specialized kind of CollisionHandler that throws an event for each collision detected.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual void add_entry(CollisionEntry *entry)
Called between a begin_group() .