00001 // Filename: physxDistanceJointDesc.cxx 00002 // Created by: enn0x (28Sep09) 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 "physxDistanceJointDesc.h" 00016 #include "physxSpringDesc.h" 00017 00018 //////////////////////////////////////////////////////////////////// 00019 // Function: PhysxDistanceJointDesc::set_max_distance 00020 // Access: Published 00021 // Description: Sets the maximum rest length of the rope or rod 00022 // between the two anchor points. 00023 //////////////////////////////////////////////////////////////////// 00024 void PhysxDistanceJointDesc:: 00025 set_max_distance(float distance) { 00026 00027 _desc.maxDistance = distance; 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: PhysxDistanceJointDesc::set_min_distance 00032 // Access: Published 00033 // Description: Sets the minimum rest length of the rope or rod 00034 // between the two anchor points 00035 //////////////////////////////////////////////////////////////////// 00036 void PhysxDistanceJointDesc:: 00037 set_min_distance(float distance) { 00038 00039 _desc.minDistance = distance; 00040 } 00041 00042 //////////////////////////////////////////////////////////////////// 00043 // Function: PhysxDistanceJointDesc::set_spring 00044 // Access: Published 00045 // Description: Makes the joint springy. The spring.targetValue 00046 // is not used. 00047 //////////////////////////////////////////////////////////////////// 00048 void PhysxDistanceJointDesc:: 00049 set_spring(const PhysxSpringDesc &spring) { 00050 00051 _desc.spring = spring._desc; 00052 } 00053 00054 //////////////////////////////////////////////////////////////////// 00055 // Function: PhysxDistanceJointDesc::set_flag 00056 // Access: Published 00057 // Description: Sets or clears a single DistanceJointFlag flag. 00058 //////////////////////////////////////////////////////////////////// 00059 void PhysxDistanceJointDesc:: 00060 set_flag(PhysxDistanceJointFlag flag, bool value) { 00061 00062 if (value == true) { 00063 _desc.flags |= flag; 00064 } 00065 else { 00066 _desc.flags &= ~(flag); 00067 } 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: PhysxDistanceJointDesc::get_max_distance 00072 // Access: Published 00073 // Description: 00074 //////////////////////////////////////////////////////////////////// 00075 float PhysxDistanceJointDesc:: 00076 get_max_distance() const { 00077 00078 return _desc.maxDistance; 00079 } 00080 00081 //////////////////////////////////////////////////////////////////// 00082 // Function: PhysxDistanceJointDesc::get_min_distance 00083 // Access: Published 00084 // Description: 00085 //////////////////////////////////////////////////////////////////// 00086 float PhysxDistanceJointDesc:: 00087 get_min_distance() const { 00088 00089 return _desc.minDistance; 00090 } 00091 00092 //////////////////////////////////////////////////////////////////// 00093 // Function: PhysxDistanceJointDesc::get_spring 00094 // Access: Published 00095 // Description: 00096 //////////////////////////////////////////////////////////////////// 00097 PhysxSpringDesc PhysxDistanceJointDesc:: 00098 get_spring() const { 00099 00100 PhysxSpringDesc value; 00101 value._desc = _desc.spring; 00102 return value; 00103 } 00104 00105 //////////////////////////////////////////////////////////////////// 00106 // Function: PhysxDistanceJointDesc::get_flag 00107 // Access: Published 00108 // Description: Return a single DistanceJointFlag flag. 00109 //////////////////////////////////////////////////////////////////// 00110 bool PhysxDistanceJointDesc:: 00111 get_flag(PhysxDistanceJointFlag flag) const { 00112 00113 return (_desc.flags & flag) ? true : false; 00114 } 00115