Panda3D
physxContactPoint.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 physxContactPoint.cxx
10  * @author enn0x
11  * @date 2009-12-20
12  */
13 
14 #include "physxContactPoint.h"
15 #include "physxManager.h"
16 #include "physxShape.h"
17 
18 TypeHandle PhysxContactPoint::_type_handle;
19 
20 /**
21  *
22  */
23 void PhysxContactPoint::
24 set(NxContactStreamIterator it) {
25 
26  _point = it.getPoint();
27  _normal = it.getPatchNormal();
28  _normal_force = it.getPointNormalForce();
29  _separation = it.getSeparation();
30  _feature_index0 = it.getFeatureIndex0();
31  _feature_index1 = it.getFeatureIndex1();
32 }
33 
34 /**
35  *
36  */
37 PhysxContactPoint PhysxContactPoint::
38 empty() {
39 
40  return PhysxContactPoint();
41 }
42 
43 
44 /**
45  * Returns the contact point position.
46  */
47 LPoint3f PhysxContactPoint::
48 get_point() const {
49 
50  return PhysxManager::nxVec3_to_point3(_point);
51 }
52 
53 /**
54  * Retrieves the patch normal.
55  */
56 LVector3f PhysxContactPoint::
57 get_normal() const {
58 
59  return PhysxManager::nxVec3_to_vec3(_normal);
60 }
61 
62 /**
63  * Retrieves the point normal force.
64  */
67 
68  return _normal_force;
69 }
70 
71 /**
72  * Return the separation for the contact point.
73  */
75 get_separation() const {
76 
77  return _separation;
78 }
79 
80 /**
81  * Retrieves the feature index.
82  */
83 unsigned int PhysxContactPoint::
85 
86  return _feature_index0;
87 }
88 
89 /**
90  * Retrieves the feature index.
91  */
92 unsigned int PhysxContactPoint::
94 
95  return _feature_index1;
96 }
float get_normal_force() const
Retrieves the point normal force.
unsigned int get_feature_index1() const
Retrieves the feature index.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:36
unsigned int get_feature_index0() const
Retrieves the feature index.
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
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
LPoint3f get_point() const
Returns the contact point position.