Panda3D

odeUniversalJoint.I
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 odeUniversalJoint.I
10 * @author joswilso
11 * @date 2006-12-27
12 */
13
14 INLINE void OdeUniversalJoint::
15 set_anchor(dReal x, dReal y, dReal z) {
16 dJointSetUniversalAnchor(_id, x, y, z);
17 }
18
19 INLINE void OdeUniversalJoint::
20 set_anchor(const LVecBase3f &anchor) {
21 dJointSetUniversalAnchor(_id, anchor[0], anchor[1], anchor[2]);
22 }
23
24 INLINE void OdeUniversalJoint::
25 set_axis1(dReal x, dReal y, dReal z) {
26 dJointSetUniversalAxis1(_id, x, y, z);
27 }
28
29 INLINE void OdeUniversalJoint::
30 set_axis1(const LVecBase3f &axis) {
31 dJointSetUniversalAxis1(_id, axis[0], axis[1], axis[2]);
32 }
33
34 INLINE void OdeUniversalJoint::
35 set_axis2(dReal x, dReal y, dReal z) {
36 dJointSetUniversalAxis2(_id, x, y, z);
37 }
38
39 INLINE void OdeUniversalJoint::
40 set_axis2(const LVecBase3f &axis) {
41 dJointSetUniversalAxis2(_id, axis[0], axis[1], axis[2]);
42 }
43
44 INLINE void OdeUniversalJoint::
45 add_torques(dReal torque1, dReal torque2) {
46 dJointAddUniversalTorques(_id, torque1, torque2);
47 }
48
49 INLINE LVecBase3f OdeUniversalJoint::
50 get_anchor() const {
51 dVector3 result;
52 dJointGetUniversalAnchor(_id, result);
53 return LVecBase3f(result[0], result[1], result[2]);
54 }
55
56 INLINE LVecBase3f OdeUniversalJoint::
57 get_anchor2() const {
58 dVector3 result;
59 dJointGetUniversalAnchor2(_id, result);
60 return LVecBase3f(result[0], result[1], result[2]);
61 }
62
63 INLINE LVecBase3f OdeUniversalJoint::
64 get_axis1() const {
65 dVector3 result;
66 dJointGetUniversalAxis1(_id, result);
67 return LVecBase3f(result[0], result[1], result[2]);
68 }
69
70 INLINE LVecBase3f OdeUniversalJoint::
71 get_axis2() const {
72 dVector3 result;
73 dJointGetUniversalAxis2(_id, result);
74 return LVecBase3f(result[0], result[1], result[2]);
75 }
76
77 INLINE dReal OdeUniversalJoint::
78 get_angle1() const {
79 return dJointGetUniversalAngle1(_id);
80 }
81
82 INLINE dReal OdeUniversalJoint::
83 get_angle2() const {
84 return dJointGetUniversalAngle2(_id);
85 }
86
87 INLINE dReal OdeUniversalJoint::
88 get_angle1_rate() const {
89 return dJointGetUniversalAngle1Rate(_id);
90 }
91
92 INLINE dReal OdeUniversalJoint::
93 get_angle2_rate() const {
94 return dJointGetUniversalAngle2Rate(_id);
95 }
96
97
98 INLINE void OdeUniversalJoint::
99 set_param_lo_stop(int axis, dReal val) {
100 nassertv( _id != 0 );
101 nassertv( 0 <= axis && axis <= 1 );
102 if ( axis == 0 ) {
103 dJointSetUniversalParam(_id, dParamLoStop, val);
104 } else if ( axis == 1 ) {
105 dJointSetUniversalParam(_id, dParamLoStop2, val);
106 }
107 }
108
109 INLINE void OdeUniversalJoint::
110 set_param_hi_stop(int axis, dReal val) {
111 nassertv( _id != 0 );
112 nassertv( 0 <= axis && axis <= 1 );
113 if ( axis == 0 ) {
114 dJointSetUniversalParam(_id, dParamHiStop, val);
115 } else if ( axis == 1 ) {
116 dJointSetUniversalParam(_id, dParamHiStop2, val);
117 }
118 }
119
120 INLINE void OdeUniversalJoint::
121 set_param_vel(int axis, dReal val) {
122 nassertv( _id != 0 );
123 nassertv( 0 <= axis && axis <= 1 );
124 if ( axis == 0 ) {
125 dJointSetUniversalParam(_id, dParamVel, val);
126 } else if ( axis == 1 ) {
127 dJointSetUniversalParam(_id, dParamVel2, val);
128 }
129 }
130
131 INLINE void OdeUniversalJoint::
132 set_param_f_max(int axis, dReal val) {
133 nassertv( _id != 0 );
134 nassertv( 0 <= axis && axis <= 1 );
135 if ( axis == 0 ) {
136 dJointSetUniversalParam(_id, dParamFMax, val);
137 } else if ( axis == 1 ) {
138 dJointSetUniversalParam(_id, dParamFMax2, val);
139 }
140 }
141
142 INLINE void OdeUniversalJoint::
143 set_param_fudge_factor(int axis, dReal val) {
144 nassertv( _id != 0 );
145 nassertv( 0 <= axis && axis <= 1 );
146 if ( axis == 0 ) {
147 dJointSetUniversalParam(_id, dParamFudgeFactor, val);
148 } else if ( axis == 1 ) {
149 dJointSetUniversalParam(_id, dParamFudgeFactor2, val);
150 }
151 }
152
153 INLINE void OdeUniversalJoint::
154 set_param_bounce(int axis, dReal val) {
155 nassertv( _id != 0 );
156 nassertv( 0 <= axis && axis <= 1 );
157 if ( axis == 0 ) {
158 dJointSetUniversalParam(_id, dParamBounce, val);
159 } else if ( axis == 1 ) {
160 dJointSetUniversalParam(_id, dParamBounce2, val);
161 }
162 }
163
164 INLINE void OdeUniversalJoint::
165 set_param_CFM(int axis, dReal val) {
166 nassertv( _id != 0 );
167 nassertv( 0 <= axis && axis <= 1 );
168 if ( axis == 0 ) {
169 dJointSetUniversalParam(_id, dParamCFM, val);
170 } else if ( axis == 1 ) {
171 dJointSetUniversalParam(_id, dParamCFM2, val);
172 }
173 }
174
175 INLINE void OdeUniversalJoint::
176 set_param_stop_ERP(int axis, dReal val) {
177 nassertv( _id != 0 );
178 nassertv( 0 <= axis && axis <= 1 );
179 if ( axis == 0 ) {
180 dJointSetUniversalParam(_id, dParamStopERP, val);
181 } else if ( axis == 1 ) {
182 dJointSetUniversalParam(_id, dParamStopERP2, val);
183 }
184 }
185
186 INLINE void OdeUniversalJoint::
187 set_param_stop_CFM(int axis, dReal val) {
188 nassertv( _id != 0 );
189 nassertv( 0 <= axis && axis <= 1 );
190 if ( axis == 0 ) {
191 dJointSetUniversalParam(_id, dParamStopCFM, val);
192 } else if ( axis == 1 ) {
193 dJointSetUniversalParam(_id, dParamStopCFM2, val);
194 }
195 }
196
197 INLINE dReal OdeUniversalJoint::
198 get_param_lo_stop(int axis) const {
199 nassertr( _id != 0, 0 );
200 nassertr( 0 <= axis && axis <= 1, 0 );
201 if ( axis == 0 ) {
202 return dJointGetUniversalParam(_id, dParamLoStop);
203 } else if ( axis == 1 ) {
204 return dJointGetUniversalParam(_id, dParamLoStop2);
205 }
206 return 0;
207 }
208
209 INLINE dReal OdeUniversalJoint::
210 get_param_hi_stop(int axis) const {
211 nassertr( _id != 0, 0 );
212 nassertr( 0 <= axis && axis <= 1, 0 );
213 if ( axis == 0 ) {
214 return dJointGetUniversalParam(_id, dParamHiStop);
215 } else if ( axis == 1 ) {
216 return dJointGetUniversalParam(_id, dParamHiStop2);
217 }
218 return 0;
219 }
220
221 INLINE dReal OdeUniversalJoint::
222 get_param_vel(int axis) const {
223 nassertr( _id != 0, 0 );
224 nassertr( 0 <= axis && axis <= 1, 0 );
225 if ( axis == 0 ) {
226 return dJointGetUniversalParam(_id, dParamVel);
227 } else if ( axis == 1 ) {
228 return dJointGetUniversalParam(_id, dParamVel2);
229 }
230 return 0;
231 }
232
233 INLINE dReal OdeUniversalJoint::
234 get_param_f_max(int axis) const {
235 nassertr( _id != 0, 0 );
236 nassertr( 0 <= axis && axis <= 1, 0 );
237 if ( axis == 0 ) {
238 return dJointGetUniversalParam(_id, dParamFMax);
239 } else if ( axis == 1 ) {
240 return dJointGetUniversalParam(_id, dParamFMax2);
241 }
242 return 0;
243 }
244
245 INLINE dReal OdeUniversalJoint::
246 get_param_fudge_factor(int axis) const {
247 nassertr( _id != 0, 0 );
248 nassertr( 0 <= axis && axis <= 1, 0 );
249 if ( axis == 0 ) {
250 return dJointGetUniversalParam(_id, dParamFudgeFactor);
251 } else if ( axis == 1 ) {
252 return dJointGetUniversalParam(_id, dParamFudgeFactor2);
253 }
254 return 0;
255 }
256
257 INLINE dReal OdeUniversalJoint::
258 get_param_bounce(int axis) const {
259 nassertr( _id != 0, 0 );
260 nassertr( 0 <= axis && axis <= 1, 0 );
261 if ( axis == 0 ) {
262 return dJointGetUniversalParam(_id, dParamBounce);
263 } else if ( axis == 1 ) {
264 return dJointGetUniversalParam(_id, dParamBounce2);
265 }
266 return 0;
267 }
268
269 INLINE dReal OdeUniversalJoint::
270 get_param_CFM(int axis) const {
271 nassertr( _id != 0, 0 );
272 nassertr( 0 <= axis && axis <= 1, 0 );
273 if ( axis == 0 ) {
274 return dJointGetUniversalParam(_id, dParamCFM);
275 } else if ( axis == 1 ) {
276 return dJointGetUniversalParam(_id, dParamCFM2);
277 }
278 return 0;
279 }
280
281 INLINE dReal OdeUniversalJoint::
282 get_param_stop_ERP(int axis) const {
283 nassertr( _id != 0, 0 );
284 nassertr( 0 <= axis && axis <= 1, 0 );
285 if ( axis == 0 ) {
286 return dJointGetUniversalParam(_id, dParamStopERP);
287 } else if ( axis == 1 ) {
288 return dJointGetUniversalParam(_id, dParamStopERP2);
289 }
290 return 0;
291 }
292
293 INLINE dReal OdeUniversalJoint::
294 get_param_stop_CFM(int axis) const {
295 nassertr( _id != 0, 0 );
296 nassertr( 0 <= axis && axis <= 1, 0 );
297 if ( axis == 0 ) {
298 return dJointGetUniversalParam(_id, dParamStopCFM);
299 } else if ( axis == 1 ) {
300 return dJointGetUniversalParam(_id, dParamStopCFM2);
301 }
302 return 0;
303 }