Panda3D
 All Classes Functions Variables Enumerations
physxRevoluteJointDesc.cxx
1 // Filename: physxRevoluteJointDesc.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 "physxRevoluteJointDesc.h"
16 #include "physxSpringDesc.h"
17 #include "physxMotorDesc.h"
18 #include "physxJointLimitDesc.h"
19 
20 ////////////////////////////////////////////////////////////////////
21 // Function: PhysxRevoluteJointDesc::set_projection_distance
22 // Access: Published
23 // Description: Sets the distance beyond which the joint is
24 // projected.
25 ////////////////////////////////////////////////////////////////////
27 set_projection_distance(float distance) {
28 
29  _desc.projectionDistance = distance;
30 }
31 
32 ////////////////////////////////////////////////////////////////////
33 // Function: PhysxRevoluteJointDesc::set_projection_angle
34 // Access: Published
35 // Description: Sets the angle beyond which the joint is projected.
36 ////////////////////////////////////////////////////////////////////
38 set_projection_angle(float angle) {
39 
40  _desc.projectionAngle = angle;
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: PhysxRevoluteJointDesc::set_spring
45 // Access: Published
46 // Description: Sets an aptional spring.
47 ////////////////////////////////////////////////////////////////////
49 set_spring(const PhysxSpringDesc &spring) {
50 
51  _desc.spring = spring._desc;
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: PhysxRevoluteJointDesc::set_flag
56 // Access: Published
57 // Description: Sets or clears a single RevoluteJointFlag flag.
58 ////////////////////////////////////////////////////////////////////
60 set_flag(PhysxRevoluteJointFlag 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: PhysxRevoluteJointDesc::set_projection_mode
72 // Access: Published
73 // Description: Use this to enable joint projection.
74 // Default is PM_none.
75 ////////////////////////////////////////////////////////////////////
77 set_projection_mode(PhysxProjectionMode mode) {
78 
79  _desc.projectionMode = (NxJointProjectionMode)mode;
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: PhysxRevoluteJointDesc::set_motor
84 // Access: Published
85 // Description: Sets an optional joint motor.
86 ////////////////////////////////////////////////////////////////////
88 set_motor(const PhysxMotorDesc &motor) {
89 
90  _desc.motor = motor._desc;
91 }
92 
93 ////////////////////////////////////////////////////////////////////
94 // Function: PhysxRevoluteJointDesc::set_limit_low
95 // Access: Published
96 // Description: Sets optional limits for the angular motion of the
97 // joint.
98 ////////////////////////////////////////////////////////////////////
101 
102  _desc.limit.low = low._desc;
103 }
104 
105 ////////////////////////////////////////////////////////////////////
106 // Function: PhysxRevoluteJointDesc::set_limit_high
107 // Access: Published
108 // Description: Sets optional limits for the angular motion of the
109 // joint.
110 ////////////////////////////////////////////////////////////////////
113 
114  _desc.limit.high = high._desc;
115 }
116 
117 ////////////////////////////////////////////////////////////////////
118 // Function: PhysxRevoluteJointDesc::get_projection_distance
119 // Access: Published
120 // Description: Return the distance beyond which the joint is
121 // projected.
122 ////////////////////////////////////////////////////////////////////
125 
126  return _desc.projectionDistance;
127 }
128 
129 ////////////////////////////////////////////////////////////////////
130 // Function: PhysxRevoluteJointDesc::get_projection_angle
131 // Access: Published
132 // Description: Return the angle beyond which the joint is
133 // projected.
134 ////////////////////////////////////////////////////////////////////
137 
138  return _desc.projectionAngle;
139 }
140 
141 ////////////////////////////////////////////////////////////////////
142 // Function: PhysxRevoluteJointDesc::get_spring
143 // Access: Published
144 // Description:
145 ////////////////////////////////////////////////////////////////////
146 PhysxSpringDesc PhysxRevoluteJointDesc::
147 get_spring() const {
148 
149  PhysxSpringDesc value;
150  value._desc = _desc.spring;
151  return value;
152 }
153 
154 ////////////////////////////////////////////////////////////////////
155 // Function: PhysxRevoluteJointDesc::get_flag
156 // Access: Published
157 // Description:
158 ////////////////////////////////////////////////////////////////////
159 bool PhysxRevoluteJointDesc::
160 get_flag(PhysxRevoluteJointFlag flag) const {
161 
162  return (_desc.flags & flag) ? true : false;
163 }
164 
165 ////////////////////////////////////////////////////////////////////
166 // Function: PhysxRevoluteJointDesc::get_projection_mode
167 // Access: Published
168 // Description:
169 ////////////////////////////////////////////////////////////////////
170 PhysxEnums::PhysxProjectionMode PhysxRevoluteJointDesc::
171 get_projection_mode() const {
172 
173  return (PhysxProjectionMode)_desc.projectionMode;
174 }
175 
176 ////////////////////////////////////////////////////////////////////
177 // Function: PhysxRevoluteJointDesc::get_motor
178 // Access: Published
179 // Description: Sets an optional joint motor.
180 ////////////////////////////////////////////////////////////////////
182 get_motor() const {
183 
184  PhysxMotorDesc value;
185  value._desc = _desc.motor;
186  return value;
187 }
188 
189 ////////////////////////////////////////////////////////////////////
190 // Function: PhysxRevoluteJointDesc::get_limit_low
191 // Access: Published
192 // Description:
193 ////////////////////////////////////////////////////////////////////
194 PhysxJointLimitDesc PhysxRevoluteJointDesc::
195 get_limit_low() const {
196 
197  PhysxJointLimitDesc value;
198  value._desc = _desc.limit.low;
199  return value;
200 }
201 
202 ////////////////////////////////////////////////////////////////////
203 // Function: PhysxRevoluteJointDesc::get_limit_high
204 // Access: Published
205 // Description:
206 ////////////////////////////////////////////////////////////////////
207 PhysxJointLimitDesc PhysxRevoluteJointDesc::
208 get_limit_high() const {
209 
210  PhysxJointLimitDesc value;
211  value._desc = _desc.limit.high;
212  return value;
213 }
214 
void set_limit_low(const PhysxJointLimitDesc &low)
Sets optional limits for the angular motion of the joint.
void set_spring(const PhysxSpringDesc &spring)
Sets an aptional spring.
PhysxMotorDesc get_motor() const
Sets an optional joint motor.
Describes a joint motor.
void set_motor(const PhysxMotorDesc &motor)
Sets an optional joint motor.
Describes a joint spring.
float get_projection_angle() const
Return the angle beyond which the joint is projected.
float get_projection_distance() const
Return the distance beyond which the joint is projected.
void set_projection_distance(float distance)
Sets the distance beyond which the joint is projected.
void set_flag(PhysxRevoluteJointFlag flag, bool value)
Sets or clears a single RevoluteJointFlag flag.
Describes a joint limit.
void set_projection_angle(float angle)
Sets the angle beyond which the joint is projected.
void set_limit_high(const PhysxJointLimitDesc &high)
Sets optional limits for the angular motion of the joint.
void set_projection_mode(PhysxProjectionMode mode)
Use this to enable joint projection.