Panda3D
bulletClosestHitRayResult.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 bulletClosestHitRayResult.h
10  * @author enn0x
11  * @date 2010-02-21
12  */
13 
14 #ifndef __BULLET_CLOSEST_HIT_RAY_RESULT_H__
15 #define __BULLET_CLOSEST_HIT_RAY_RESULT_H__
16 
17 #include "pandabase.h"
18 
19 #include "bullet_includes.h"
20 #include "bullet_utils.h"
21 
22 #include "luse.h"
23 #include "pandaNode.h"
24 #include "collideMask.h"
25 
26 /**
27  *
28  */
29 struct EXPCL_PANDABULLET BulletClosestHitRayResult : public btCollisionWorld::ClosestRayResultCallback {
30 
31 PUBLISHED:
32  INLINE static BulletClosestHitRayResult empty();
33 
34  LPoint3 get_from_pos() const;
35  LPoint3 get_to_pos() const;
36 
37  bool has_hit() const;
38 
39  PandaNode *get_node() const;
40  LPoint3 get_hit_pos() const;
41  LVector3 get_hit_normal() const;
42  PN_stdfloat get_hit_fraction() const;
43 
44  int get_shape_part() const;
45  int get_triangle_index() const;
46 
47  MAKE_PROPERTY(from_pos, get_from_pos);
48  MAKE_PROPERTY(to_pos, get_to_pos);
49  MAKE_PROPERTY(node, get_node);
50  MAKE_PROPERTY(hit_pos, get_hit_pos);
51  MAKE_PROPERTY(hit_normal, get_hit_normal);
52  MAKE_PROPERTY(hit_fraction, get_hit_fraction);
53  MAKE_PROPERTY(shape_part, get_shape_part);
54  MAKE_PROPERTY(triangle_index, get_triangle_index);
55 
56 public:
57  virtual bool needsCollision(btBroadphaseProxy* proxy0) const;
58  virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace);
59 
60 private:
61  BulletClosestHitRayResult(const btVector3 &from_pos, const btVector3 &to_pos, const CollideMask &mask);
62 
63  CollideMask _mask;
64 
65  int _shapePart;
66  int _triangleIndex;
67 
68  friend class BulletWorld;
69 };
70 
72 
73 #endif // __BULLET_CLOSEST_HIT_RAY_RESULT_H__
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.