Panda3D
physxRaycastHit.cxx
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 physxRaycastHit.cxx
10  * @author enn0x
11  * @date 2009-10-21
12  */
13 
14 #include "physxRaycastHit.h"
15 #include "physxManager.h"
16 #include "physxShape.h"
17 
18 /**
19  *
20  */
21 bool PhysxRaycastHit::
22 is_empty() const {
23 
24  return (_hit.shape == nullptr);
25 }
26 
27 /**
28  *
29  */
30 PhysxShape *PhysxRaycastHit::
31 get_shape() const {
32 
33  nassertr_always(_hit.shape, nullptr);
34  return (PhysxShape *)_hit.shape->userData;
35 }
36 
37 /**
38  *
39  */
40 LPoint3f PhysxRaycastHit::
41 get_impact_pos() const {
42 
43  return PhysxManager::nxVec3_to_point3(_hit.worldImpact);
44 }
45 
46 /**
47  *
48  */
49 LVector3f PhysxRaycastHit::
50 get_impact_normal() const {
51 
52  return PhysxManager::nxVec3_to_vec3(_hit.worldNormal);
53 }
54 
55 /**
56  *
57  */
58 float PhysxRaycastHit::
59 get_distance() const {
60 
61  return _hit.distance;
62 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Abstract base class for shapes.
Definition: physxShape.h:39
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
Definition: physxManager.I:36
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
Definition: physxManager.I:72