Panda3D
 All Classes Functions Variables Enumerations
physxRaycastHit.cxx
1 // Filename: physxRaycastHit.cxx
2 // Created by: enn0x (21Oct09)
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 #include "physxRaycastHit.h"
16 #include "physxManager.h"
17 #include "physxShape.h"
18 
19 ////////////////////////////////////////////////////////////////////
20 // Function: PhysxRaycastHit::is_empty
21 // Access: Published
22 // Description:
23 ////////////////////////////////////////////////////////////////////
24 bool PhysxRaycastHit::
25 is_empty() const {
26 
27  return (_hit.shape == NULL);
28 }
29 
30 ////////////////////////////////////////////////////////////////////
31 // Function: PhysxRaycastHit::get_shape
32 // Access: Published
33 // Description:
34 ////////////////////////////////////////////////////////////////////
35 PhysxShape *PhysxRaycastHit::
36 get_shape() const {
37 
38  nassertr_always(_hit.shape, NULL);
39  return (PhysxShape *)_hit.shape->userData;
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: PhysxRaycastHit::get_impact_pos
44 // Access: Published
45 // Description:
46 ////////////////////////////////////////////////////////////////////
47 LPoint3f PhysxRaycastHit::
48 get_impact_pos() const {
49 
50  return PhysxManager::nxVec3_to_point3(_hit.worldImpact);
51 }
52 
53 ////////////////////////////////////////////////////////////////////
54 // Function: PhysxRaycastHit::get_impact_normal
55 // Access: Published
56 // Description:
57 ////////////////////////////////////////////////////////////////////
58 LVector3f PhysxRaycastHit::
59 get_impact_normal() const {
60 
61  return PhysxManager::nxVec3_to_vec3(_hit.worldNormal);
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: PhysxRaycastHit::get_distance
66 // Access: Published
67 // Description:
68 ////////////////////////////////////////////////////////////////////
69 float PhysxRaycastHit::
70 get_distance() const {
71 
72  return _hit.distance;
73 }
74 
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 LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
Definition: physxManager.I:44
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
Definition: physxManager.I:88