Panda3D
Loading...
Searching...
No Matches
odeCollisionEntry.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 odeCollisionEntry.h
10 * @author rdb
11 * @date 2009-03-05
12 */
13
14#ifndef ODECOLLISIONENTRY_H
15#define ODECOLLISIONENTRY_H
16
17#include "pandabase.h"
18#include "typedReferenceCount.h"
19
20#include "odeContactGeom.h"
21
22class OdeUtil;
23
24/**
25 * A class used to hold information about a collision that has occurred.
26 */
27class EXPCL_PANDAODE OdeCollisionEntry : public TypedReferenceCount {
28PUBLISHED:
29 virtual ~OdeCollisionEntry();
30
31 INLINE OdeGeom get_geom1() const;
32 INLINE OdeGeom get_geom2() const;
33 INLINE OdeBody get_body1() const;
34 INLINE OdeBody get_body2() const;
35
36 INLINE size_t get_num_contacts() const;
37 INLINE LPoint3f get_contact_point(size_t n) const;
38 INLINE OdeContactGeom get_contact_geom(size_t n) const;
39 INLINE OdeContactGeom operator [] (size_t n) const;
40 MAKE_SEQ(get_contact_points, get_num_contacts, get_contact_point);
41 MAKE_SEQ(get_contact_geoms, get_num_contacts, get_contact_geom);
42
43 INLINE operator bool () const;
44 INLINE bool is_empty() const;
45
46private:
47 INLINE OdeCollisionEntry();
48 dGeomID _geom1, _geom2;
49 dBodyID _body1, _body2;
50 size_t _num_contacts;
51 OdeContactGeom *_contact_geoms;
52
53public:
54 static TypeHandle get_class_type() {
55 return _type_handle;
56 }
57 static void init_type() {
58 TypedReferenceCount::init_type();
59 register_type(_type_handle, "OdeCollisionEntry",
60 TypedReferenceCount::get_class_type());
61 }
62 virtual TypeHandle get_type() const {
63 return get_class_type();
64 }
65 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
66
67private:
68
69 static TypeHandle _type_handle;
70
71 friend class OdeSpace;
72 friend class OdeUtil;
73};
74
75#include "odeCollisionEntry.I"
76
77#endif
get_num_contacts
Returns the number of contacts in the collision.
get_contact_point
Returns the nth contact point in the collision.
OdeGeom get_geom1() const
Returns the first geom in the collision.
get_contact_geom
Returns the nth contact geom in the collision.
OdeBody get_body2() const
Returns the second body in the collision.
bool is_empty() const
Returns true if the entry holds no contacts.
OdeBody get_body1() const
Returns the first body in the collision.
OdeGeom get_geom2() const
Returns the second geom in the collision.
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(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.