Panda3D
physxContactPoint.cxx
1 // Filename: physxContactPoint.cxx
2 // Created by: enn0x (20Dec09)
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 "physxContactPoint.h"
16 #include "physxManager.h"
17 #include "physxShape.h"
18 
19 TypeHandle PhysxContactPoint::_type_handle;
20 
21 ////////////////////////////////////////////////////////////////////
22 // Function: PhysxContactPoint::set
23 // Access: Public
24 // Description:
25 ////////////////////////////////////////////////////////////////////
26 void PhysxContactPoint::
27 set(NxContactStreamIterator it) {
28 
29  _point = it.getPoint();
30  _normal = it.getPatchNormal();
31  _normal_force = it.getPointNormalForce();
32  _separation = it.getSeparation();
33  _feature_index0 = it.getFeatureIndex0();
34  _feature_index1 = it.getFeatureIndex1();
35 }
36 
37 ////////////////////////////////////////////////////////////////////
38 // Function: PhysxContactPoint::empty
39 // Access: Public
40 // Description:
41 ////////////////////////////////////////////////////////////////////
42 PhysxContactPoint PhysxContactPoint::
43 empty() {
44 
45  return PhysxContactPoint();
46 }
47 
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function: PhysxContactPoint::get_point
51 // Access: Published
52 // Description: Returns the contact point position.
53 ////////////////////////////////////////////////////////////////////
55 get_point() const {
56 
57  return PhysxManager::nxVec3_to_point3(_point);
58 }
59 
60 ////////////////////////////////////////////////////////////////////
61 // Function: PhysxContactPoint::get_normal
62 // Access: Published
63 // Description: Retrieves the patch normal.
64 ////////////////////////////////////////////////////////////////////
66 get_normal() const {
67 
68  return PhysxManager::nxVec3_to_vec3(_normal);
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: PhysxContactPoint::get_normal_force
73 // Access: Published
74 // Description: Retrieves the point normal force.
75 ////////////////////////////////////////////////////////////////////
78 
79  return _normal_force;
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: PhysxContactPoint::get_separation
84 // Access: Published
85 // Description: Return the separation for the contact point.
86 ////////////////////////////////////////////////////////////////////
88 get_separation() const {
89 
90  return _separation;
91 }
92 
93 ////////////////////////////////////////////////////////////////////
94 // Function: PhysxContactPoint::get_feature_index0
95 // Access: Published
96 // Description: Retrieves the feature index.
97 ////////////////////////////////////////////////////////////////////
98 unsigned int PhysxContactPoint::
100 
101  return _feature_index0;
102 }
103 
104 ////////////////////////////////////////////////////////////////////
105 // Function: PhysxContactPoint::get_feature_index1
106 // Access: Published
107 // Description: Retrieves the feature index.
108 ////////////////////////////////////////////////////////////////////
109 unsigned int PhysxContactPoint::
111 
112  return _feature_index1;
113 }
114 
float get_normal_force() const
Retrieves the point normal force.
unsigned int get_feature_index1() const
Retrieves the feature index.
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
A helper structure for iterating over contact streams reported by PhysxContactPair.
LVector3f get_normal() const
Retrieves the patch normal.
float get_separation() const
Return the separation for the contact point.
static LVector3f nxVec3_to_vec3(const NxVec3 &v)
Converts from NxVec3 to LVector3f.
Definition: physxManager.I:44
unsigned int get_feature_index0() const
Retrieves the feature index.
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
Definition: physxManager.I:88
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
LPoint3f get_point() const
Returns the contact point position.