Panda3D
Loading...
Searching...
No Matches
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
14INLINE void OdeUniversalJoint::
15set_anchor(dReal x, dReal y, dReal z) {
16 dJointSetUniversalAnchor(_id, x, y, z);
17}
18
19INLINE void OdeUniversalJoint::
20set_anchor(const LVecBase3f &anchor) {
21 dJointSetUniversalAnchor(_id, anchor[0], anchor[1], anchor[2]);
22}
23
24INLINE void OdeUniversalJoint::
25set_axis1(dReal x, dReal y, dReal z) {
26 dJointSetUniversalAxis1(_id, x, y, z);
27}
28
29INLINE void OdeUniversalJoint::
30set_axis1(const LVecBase3f &axis) {
31 dJointSetUniversalAxis1(_id, axis[0], axis[1], axis[2]);
32}
33
34INLINE void OdeUniversalJoint::
35set_axis2(dReal x, dReal y, dReal z) {
36 dJointSetUniversalAxis2(_id, x, y, z);
37}
38
39INLINE void OdeUniversalJoint::
40set_axis2(const LVecBase3f &axis) {
41 dJointSetUniversalAxis2(_id, axis[0], axis[1], axis[2]);
42}
43
44INLINE void OdeUniversalJoint::
45add_torques(dReal torque1, dReal torque2) {
46 dJointAddUniversalTorques(_id, torque1, torque2);
47}
48
49INLINE LVecBase3f OdeUniversalJoint::
50get_anchor() const {
51 dVector3 result;
52 dJointGetUniversalAnchor(_id, result);
53 return LVecBase3f(result[0], result[1], result[2]);
54}
55
56INLINE LVecBase3f OdeUniversalJoint::
57get_anchor2() const {
58 dVector3 result;
59 dJointGetUniversalAnchor2(_id, result);
60 return LVecBase3f(result[0], result[1], result[2]);
61}
62
63INLINE LVecBase3f OdeUniversalJoint::
64get_axis1() const {
65 dVector3 result;
66 dJointGetUniversalAxis1(_id, result);
67 return LVecBase3f(result[0], result[1], result[2]);
68}
69
70INLINE LVecBase3f OdeUniversalJoint::
71get_axis2() const {
72 dVector3 result;
73 dJointGetUniversalAxis2(_id, result);
74 return LVecBase3f(result[0], result[1], result[2]);
75}
76
77INLINE dReal OdeUniversalJoint::
78get_angle1() const {
79 return dJointGetUniversalAngle1(_id);
80}
81
82INLINE dReal OdeUniversalJoint::
83get_angle2() const {
84 return dJointGetUniversalAngle2(_id);
85}
86
87INLINE dReal OdeUniversalJoint::
88get_angle1_rate() const {
89 return dJointGetUniversalAngle1Rate(_id);
90}
91
92INLINE dReal OdeUniversalJoint::
93get_angle2_rate() const {
94 return dJointGetUniversalAngle2Rate(_id);
95}
96
97
98INLINE void OdeUniversalJoint::
99set_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
109INLINE void OdeUniversalJoint::
110set_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
120INLINE void OdeUniversalJoint::
121set_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
131INLINE void OdeUniversalJoint::
132set_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
142INLINE void OdeUniversalJoint::
143set_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
153INLINE void OdeUniversalJoint::
154set_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
164INLINE void OdeUniversalJoint::
165set_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
175INLINE void OdeUniversalJoint::
176set_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
186INLINE void OdeUniversalJoint::
187set_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
197INLINE dReal OdeUniversalJoint::
198get_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
209INLINE dReal OdeUniversalJoint::
210get_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
221INLINE dReal OdeUniversalJoint::
222get_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
233INLINE dReal OdeUniversalJoint::
234get_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
245INLINE dReal OdeUniversalJoint::
246get_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
257INLINE dReal OdeUniversalJoint::
258get_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
269INLINE dReal OdeUniversalJoint::
270get_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
281INLINE dReal OdeUniversalJoint::
282get_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
293INLINE dReal OdeUniversalJoint::
294get_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}