Panda3D
|
00001 // Filename: physxContactPoint.cxx 00002 // Created by: enn0x (20Dec09) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "physxContactPoint.h" 00016 #include "physxManager.h" 00017 #include "physxShape.h" 00018 00019 TypeHandle PhysxContactPoint::_type_handle; 00020 00021 //////////////////////////////////////////////////////////////////// 00022 // Function: PhysxContactPoint::set 00023 // Access: Public 00024 // Description: 00025 //////////////////////////////////////////////////////////////////// 00026 void PhysxContactPoint:: 00027 set(NxContactStreamIterator it) { 00028 00029 _point = it.getPoint(); 00030 _normal = it.getPatchNormal(); 00031 _normal_force = it.getPointNormalForce(); 00032 _separation = it.getSeparation(); 00033 _feature_index0 = it.getFeatureIndex0(); 00034 _feature_index1 = it.getFeatureIndex1(); 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: PhysxContactPoint::empty 00039 // Access: Public 00040 // Description: 00041 //////////////////////////////////////////////////////////////////// 00042 PhysxContactPoint PhysxContactPoint:: 00043 empty() { 00044 00045 return PhysxContactPoint(); 00046 } 00047 00048 00049 //////////////////////////////////////////////////////////////////// 00050 // Function: PhysxContactPoint::get_point 00051 // Access: Published 00052 // Description: Returns the contact point position. 00053 //////////////////////////////////////////////////////////////////// 00054 LPoint3f PhysxContactPoint:: 00055 get_point() const { 00056 00057 return PhysxManager::nxVec3_to_point3(_point); 00058 } 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: PhysxContactPoint::get_normal 00062 // Access: Published 00063 // Description: Retrieves the patch normal. 00064 //////////////////////////////////////////////////////////////////// 00065 LVector3f PhysxContactPoint:: 00066 get_normal() const { 00067 00068 return PhysxManager::nxVec3_to_vec3(_normal); 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function: PhysxContactPoint::get_normal_force 00073 // Access: Published 00074 // Description: Retrieves the point normal force. 00075 //////////////////////////////////////////////////////////////////// 00076 float PhysxContactPoint:: 00077 get_normal_force() const { 00078 00079 return _normal_force; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: PhysxContactPoint::get_separation 00084 // Access: Published 00085 // Description: Return the separation for the contact point. 00086 //////////////////////////////////////////////////////////////////// 00087 float PhysxContactPoint:: 00088 get_separation() const { 00089 00090 return _separation; 00091 } 00092 00093 //////////////////////////////////////////////////////////////////// 00094 // Function: PhysxContactPoint::get_feature_index0 00095 // Access: Published 00096 // Description: Retrieves the feature index. 00097 //////////////////////////////////////////////////////////////////// 00098 unsigned int PhysxContactPoint:: 00099 get_feature_index0() const { 00100 00101 return _feature_index0; 00102 } 00103 00104 //////////////////////////////////////////////////////////////////// 00105 // Function: PhysxContactPoint::get_feature_index1 00106 // Access: Published 00107 // Description: Retrieves the feature index. 00108 //////////////////////////////////////////////////////////////////// 00109 unsigned int PhysxContactPoint:: 00110 get_feature_index1() const { 00111 00112 return _feature_index1; 00113 } 00114