Panda3D
 All Classes Functions Variables Enumerations
physxDistanceJointDesc.cxx
1 // Filename: physxDistanceJointDesc.cxx
2 // Created by: enn0x (28Sep09)
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 "physxDistanceJointDesc.h"
16 #include "physxSpringDesc.h"
17 
18 ////////////////////////////////////////////////////////////////////
19 // Function: PhysxDistanceJointDesc::set_max_distance
20 // Access: Published
21 // Description: Sets the maximum rest length of the rope or rod
22 // between the two anchor points.
23 ////////////////////////////////////////////////////////////////////
25 set_max_distance(float distance) {
26 
27  _desc.maxDistance = distance;
28 }
29 
30 ////////////////////////////////////////////////////////////////////
31 // Function: PhysxDistanceJointDesc::set_min_distance
32 // Access: Published
33 // Description: Sets the minimum rest length of the rope or rod
34 // between the two anchor points
35 ////////////////////////////////////////////////////////////////////
37 set_min_distance(float distance) {
38 
39  _desc.minDistance = distance;
40 }
41 
42 ////////////////////////////////////////////////////////////////////
43 // Function: PhysxDistanceJointDesc::set_spring
44 // Access: Published
45 // Description: Makes the joint springy. The spring.targetValue
46 // is not used.
47 ////////////////////////////////////////////////////////////////////
49 set_spring(const PhysxSpringDesc &spring) {
50 
51  _desc.spring = spring._desc;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: PhysxDistanceJointDesc::set_flag
56 // Access: Published
57 // Description: Sets or clears a single DistanceJointFlag flag.
58 ////////////////////////////////////////////////////////////////////
60 set_flag(PhysxDistanceJointFlag flag, bool value) {
61 
62  if (value == true) {
63  _desc.flags |= flag;
64  }
65  else {
66  _desc.flags &= ~(flag);
67  }
68 }
69 
70 ////////////////////////////////////////////////////////////////////
71 // Function: PhysxDistanceJointDesc::get_max_distance
72 // Access: Published
73 // Description:
74 ////////////////////////////////////////////////////////////////////
75 float PhysxDistanceJointDesc::
76 get_max_distance() const {
77 
78  return _desc.maxDistance;
79 }
80 
81 ////////////////////////////////////////////////////////////////////
82 // Function: PhysxDistanceJointDesc::get_min_distance
83 // Access: Published
84 // Description:
85 ////////////////////////////////////////////////////////////////////
86 float PhysxDistanceJointDesc::
87 get_min_distance() const {
88 
89  return _desc.minDistance;
90 }
91 
92 ////////////////////////////////////////////////////////////////////
93 // Function: PhysxDistanceJointDesc::get_spring
94 // Access: Published
95 // Description:
96 ////////////////////////////////////////////////////////////////////
97 PhysxSpringDesc PhysxDistanceJointDesc::
98 get_spring() const {
99 
100  PhysxSpringDesc value;
101  value._desc = _desc.spring;
102  return value;
103 }
104 
105 ////////////////////////////////////////////////////////////////////
106 // Function: PhysxDistanceJointDesc::get_flag
107 // Access: Published
108 // Description: Return a single DistanceJointFlag flag.
109 ////////////////////////////////////////////////////////////////////
111 get_flag(PhysxDistanceJointFlag flag) const {
112 
113  return (_desc.flags & flag) ? true : false;
114 }
115 
Describes a joint spring.
void set_spring(const PhysxSpringDesc &spring)
Makes the joint springy.
void set_flag(PhysxDistanceJointFlag flag, bool value)
Sets or clears a single DistanceJointFlag flag.
void set_max_distance(float distance)
Sets the maximum rest length of the rope or rod between the two anchor points.
bool get_flag(PhysxDistanceJointFlag flag) const
Return a single DistanceJointFlag flag.
void set_min_distance(float distance)
Sets the minimum rest length of the rope or rod between the two anchor points.