Panda3D
physxControllerShapeHit.I
1 // Filename: physxControllerShapeHit.I
2 // Created by: enn0x (28Nov12)
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 ////////////////////////////////////////////////////////////////////
16 // Function: PhysxControllerShapeHit::Constructor
17 // Access: Published
18 // Description:
19 ////////////////////////////////////////////////////////////////////
20 INLINE PhysxControllerShapeHit::
21 PhysxControllerShapeHit(const NxControllerShapeHit &hit) :
22  _hit(hit) {
23 
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: PhysxControllerShapeHit::get_controller
28 // Access: Published
29 // Description:
30 ////////////////////////////////////////////////////////////////////
31 INLINE PhysxController *PhysxControllerShapeHit::
32 get_controller() const {
33 
34  if (_hit.controller) {
35  return (PhysxController *)(_hit.controller->getUserData());
36  }
37  else {
38  return NULL;
39  }
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: PhysxControllerShapeHit::get_shape
44 // Access: Published
45 // Description:
46 ////////////////////////////////////////////////////////////////////
47 INLINE PhysxShape *PhysxControllerShapeHit::
48 get_shape() const {
49 
50  if (_hit.shape) {
51  return (PhysxShape *)(_hit.shape->userData);
52  }
53  else {
54  return NULL;
55  }
56 }
57 
58 ////////////////////////////////////////////////////////////////////
59 // Function: PhysxControllerShapeHit::get_world_pos
60 // Access: Published
61 // Description:
62 ////////////////////////////////////////////////////////////////////
63 INLINE LPoint3 PhysxControllerShapeHit::
64 get_world_pos() const {
65 
66  return PhysxManager::nxExtVec3_to_point3(_hit.worldPos);
67 }
68 
69 ////////////////////////////////////////////////////////////////////
70 // Function: PhysxControllerShapeHit::get_world_normal
71 // Access: Published
72 // Description:
73 ////////////////////////////////////////////////////////////////////
74 INLINE LVector3 PhysxControllerShapeHit::
75 get_world_normal() const {
76 
77  return PhysxManager::nxVec3_to_vec3(_hit.worldNormal);
78 }
79 
80 ////////////////////////////////////////////////////////////////////
81 // Function: PhysxControllerShapeHit::get_dir
82 // Access: Published
83 // Description:
84 ////////////////////////////////////////////////////////////////////
85 INLINE LVector3 PhysxControllerShapeHit::
86 get_dir() const {
87 
88  return PhysxManager::nxVec3_to_vec3(_hit.dir);
89 }
90 
91 ////////////////////////////////////////////////////////////////////
92 // Function: PhysxControllerShapeHit::get_length
93 // Access: Published
94 // Description:
95 ////////////////////////////////////////////////////////////////////
96 INLINE PN_stdfloat PhysxControllerShapeHit::
97 get_length() const {
98 
99  return (PN_stdfloat)_hit.length;
100 }
101 
Abstract base class for shapes.
Definition: physxShape.h:41
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
static LPoint3f nxExtVec3_to_point3(const NxExtendedVec3 &p)
Converts from NxExtendedVec3 to LPoint3f.
Definition: physxManager.I:110
Abstract base class for character controllers.
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
Definition: physxManager.I:44