Panda3D
physxControllerShapeHit.I
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 physxControllerShapeHit.I
10  * @author enn0x
11  * @date 2012-11-28
12  */
13 
14 /**
15  *
16  */
17 INLINE PhysxControllerShapeHit::
18 PhysxControllerShapeHit(const NxControllerShapeHit &hit) :
19  _hit(hit) {
20 
21 }
22 
23 /**
24  *
25  */
26 INLINE PhysxController *PhysxControllerShapeHit::
27 get_controller() const {
28 
29  if (_hit.controller) {
30  return (PhysxController *)(_hit.controller->getUserData());
31  }
32  else {
33  return nullptr;
34  }
35 }
36 
37 /**
38  *
39  */
40 INLINE PhysxShape *PhysxControllerShapeHit::
41 get_shape() const {
42 
43  if (_hit.shape) {
44  return (PhysxShape *)(_hit.shape->userData);
45  }
46  else {
47  return nullptr;
48  }
49 }
50 
51 /**
52  *
53  */
54 INLINE LPoint3 PhysxControllerShapeHit::
55 get_world_pos() const {
56 
57  return PhysxManager::nxExtVec3_to_point3(_hit.worldPos);
58 }
59 
60 /**
61  *
62  */
63 INLINE LVector3 PhysxControllerShapeHit::
64 get_world_normal() const {
65 
66  return PhysxManager::nxVec3_to_vec3(_hit.worldNormal);
67 }
68 
69 /**
70  *
71  */
72 INLINE LVector3 PhysxControllerShapeHit::
73 get_dir() const {
74 
75  return PhysxManager::nxVec3_to_vec3(_hit.dir);
76 }
77 
78 /**
79  *
80  */
81 INLINE PN_stdfloat PhysxControllerShapeHit::
82 get_length() const {
83 
84  return (PN_stdfloat)_hit.length;
85 }
Abstract base class for shapes.
Definition: physxShape.h:39
static LPoint3f nxExtVec3_to_point3(const NxExtendedVec3 &p)
Converts from NxExtendedVec3 to LPoint3f.
Definition: physxManager.I:90
Abstract base class for character controllers.
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
Definition: physxManager.I:36