Panda3D
collisionHandlerHighestEvent.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 collisionHandlerHighestEvent.h
10  * @author drose
11  * @date 2002-03-16
12  */
13 
14 #ifndef COLLISIONHANDLERHIGHESTEVENT_H
15 #define COLLISIONHANDLERHIGHESTEVENT_H
16 
17 #include "pandabase.h"
18 
19 #include "collisionHandlerEvent.h"
20 #include "collisionNode.h"
21 #include "collisionEntry.h"
22 
23 #include "vector_string.h"
24 #include "pointerTo.h"
25 
26 /**
27  * A specialized kind of CollisionHandler that throws an event for each
28  * collision detected. The event thrown may be based on the name of the
29  * moving object or the struck object, or both. The first parameter of the
30  * event will be a pointer to the CollisionEntry that triggered it.
31  */
32 class EXPCL_PANDA_COLLIDE CollisionHandlerHighestEvent : public CollisionHandlerEvent {
33 PUBLISHED:
35 
36 public:
37  virtual void begin_group();
38  virtual void add_entry(CollisionEntry *entry);
39  virtual bool end_group();
40 private:
41  double _collider_distance;
42  PT(CollisionEntry) _closest_collider;
43 
44 
45 public:
46  static TypeHandle get_class_type() {
47  return _type_handle;
48  }
49  static void init_type() {
50  CollisionHandler::init_type();
51  register_type(_type_handle, "CollisionHandlerHighestEvent",
52  CollisionHandlerEvent::get_class_type());
53  }
54  virtual TypeHandle get_type() const {
55  return get_class_type();
56  }
57  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
58 
59 private:
60  static TypeHandle _type_handle;
61 };
62 
63 #endif
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.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A specialized kind of CollisionHandler that throws an event for each collision detected.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a single collision event.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:81
virtual void add_entry(CollisionEntry *entry)
Called between a begin_group() .