38 INLINE dReal OdeBody::
39 get_auto_disable_linear_threshold()
const {
40 return dBodyGetAutoDisableLinearThreshold(_id);
44 set_auto_disable_linear_threshold(dReal linear_threshold) {
45 dBodySetAutoDisableLinearThreshold(_id, linear_threshold);
48 INLINE dReal OdeBody::
49 get_auto_disable_angular_threshold()
const {
50 return dBodyGetAutoDisableAngularThreshold(_id);
54 set_auto_disable_angular_threshold(dReal angular_threshold) {
55 dBodySetAutoDisableAngularThreshold(_id, angular_threshold);
59 get_auto_disable_steps()
const {
60 return dBodyGetAutoDisableSteps(_id);
64 set_auto_disable_steps(
int steps) {
65 dBodySetAutoDisableSteps(_id, steps);
68 INLINE dReal OdeBody::
69 get_auto_disable_time()
const {
70 return dBodyGetAutoDisableTime(_id);
74 set_auto_disable_time(dReal time) {
75 dBodySetAutoDisableTime(_id, time);
79 get_auto_disable_flag()
const {
80 return dBodyGetAutoDisableFlag(_id);
84 set_auto_disable_flag(
int do_auto_disable) {
85 dBodySetAutoDisableFlag(_id, do_auto_disable);
89 set_auto_disable_defaults() {
90 dBodySetAutoDisableDefaults(_id);
94 set_data(
void *data) {
95 dBodySetData(_id, data);
100 set_data(PyObject *data) {
101 Py_XDECREF((PyObject*) dBodyGetData(_id));
103 dBodySetData(_id, data);
106 INLINE PyObject* OdeBody::
108 PyObject* data = (PyObject*) dBodyGetData(_id);
114 INLINE
void* OdeBody::
116 return dBodyGetData(_id);
120 INLINE
void OdeBody::
121 set_position(dReal x, dReal y, dReal z) {
122 dBodySetPosition(_id, x, y, z);
125 INLINE
void OdeBody::
127 set_position(pos[0], pos[1], pos[2]);
130 INLINE
void OdeBody::
132 dMatrix3 mat3 = { r(0, 0), r(0, 1), r(0, 2), 0,
133 r(1, 0), r(1, 1), r(1, 2), 0,
134 r(2, 0), r(2, 1), r(2, 2), 0 };
136 dBodySetRotation(_id, mat3);
139 INLINE
void OdeBody::
141 dQuaternion quat = { q[0], q[1], q[2], q[3] };
142 dBodySetQuaternion(_id, quat);
145 INLINE
void OdeBody::
146 set_linear_vel(dReal x, dReal y, dReal z) {
147 dBodySetLinearVel(_id, x, y, z);
150 INLINE
void OdeBody::
152 set_linear_vel(vel[0], vel[1], vel[2]);
155 INLINE
void OdeBody::
156 set_angular_vel(dReal x, dReal y, dReal z) {
157 dBodySetAngularVel(_id, x, y, z);
160 INLINE
void OdeBody::
162 set_angular_vel(vel[0], vel[1], vel[2]);
166 get_position()
const {
167 const dReal *res = dBodyGetPosition(_id);
172 get_rotation()
const {
173 const dReal *rot = dBodyGetRotation(_id);
175 rot[4], rot[5], rot[6],
176 rot[8], rot[9], rot[10]);
180 get_quaternion()
const {
181 const dReal *res = dBodyGetQuaternion(_id);
182 return LVecBase4f(res[0], res[1], res[2], res[3]);
186 get_linear_vel()
const {
187 const dReal *res = dBodyGetLinearVel(_id);
192 get_angular_vel()
const {
193 const dReal *res = dBodyGetAngularVel(_id);
197 INLINE
void OdeBody::
199 dBodySetMass(_id, mass.get_mass_ptr());
205 dBodyGetMass(_id, mass.get_mass_ptr());
209 INLINE
void OdeBody::
210 add_force(dReal fx, dReal fy, dReal fz) {
211 dBodyAddForce(_id, fx, fy, fz);
214 INLINE
void OdeBody::
216 add_force(f[0], f[1], f[2]);
219 INLINE
void OdeBody::
220 add_torque(dReal fx, dReal fy, dReal fz) {
221 dBodyAddTorque(_id, fx, fy, fz);
224 INLINE
void OdeBody::
226 add_torque(f[0], f[1], f[2]);
229 INLINE
void OdeBody::
230 add_rel_force(dReal fx, dReal fy, dReal fz) {
231 dBodyAddRelForce(_id, fx, fy, fz);
234 INLINE
void OdeBody::
236 add_rel_force(f[0], f[1], f[2]);
239 INLINE
void OdeBody::
240 add_rel_torque(dReal fx, dReal fy, dReal fz) {
241 dBodyAddRelTorque(_id, fx, fy, fz);
244 INLINE
void OdeBody::
246 add_rel_torque(f[0], f[1], f[2]);
249 INLINE
void OdeBody::
250 add_force_at_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
251 dBodyAddForceAtPos(_id, fx, fy, fz, px, py, pz);
254 INLINE
void OdeBody::
256 add_force_at_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
259 INLINE
void OdeBody::
260 add_force_at_rel_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
261 dBodyAddForceAtRelPos(_id, fx, fy, fz, px, py, pz);
264 INLINE
void OdeBody::
266 add_force_at_rel_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
269 INLINE
void OdeBody::
270 add_rel_force_at_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
271 dBodyAddRelForceAtPos(_id, fx, fy, fz, px, py, pz);
274 INLINE
void OdeBody::
276 add_rel_force_at_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
279 INLINE
void OdeBody::
280 add_rel_force_at_rel_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
281 dBodyAddRelForceAtRelPos(_id, fx, fy, fz, px, py, pz);
284 INLINE
void OdeBody::
286 add_rel_force_at_rel_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
289 INLINE
void OdeBody::
290 set_force(dReal x, dReal y, dReal z) {
291 dBodySetForce(_id, x, y, z);
294 INLINE
void OdeBody::
296 set_force(f[0], f[1], f[2]);
299 INLINE
void OdeBody::
300 set_torque(dReal x, dReal y, dReal z) {
301 dBodySetTorque(_id, x, y, z);
304 INLINE
void OdeBody::
306 set_torque(f[0], f[1], f[2]);
310 get_rel_point_pos(dReal px, dReal py, dReal pz)
const {
312 dBodyGetRelPointPos(_id, px, py, pz, result);
313 return LPoint3f(result[0], result[1], result[2]);
317 get_rel_point_pos(
const LVecBase3f &pos)
const {
318 return get_rel_point_pos(pos[0], pos[1], pos[2]);
322 get_rel_point_vel(dReal px, dReal py, dReal pz)
const {
324 dBodyGetRelPointVel(_id, px, py, pz, result);
325 return LPoint3f(result[0], result[1], result[2]);
329 get_rel_point_vel(
const LVecBase3f &pos)
const {
330 return get_rel_point_vel(pos[0], pos[1], pos[2]);
334 get_point_vel(dReal px, dReal py, dReal pz)
const {
336 dBodyGetPointVel(_id, px, py, pz, result);
337 return LPoint3f(result[0], result[1], result[2]);
342 return get_point_vel(pos[0], pos[1], pos[2]);
346 get_pos_rel_point(dReal px, dReal py, dReal pz)
const {
348 dBodyGetPosRelPoint(_id, px, py, pz, result);
349 return LPoint3f(result[0], result[1], result[2]);
353 get_pos_rel_point(
const LVecBase3f &pos)
const {
354 return get_pos_rel_point(pos[0], pos[1], pos[2]);
358 vector_to_world(dReal px, dReal py, dReal pz)
const {
360 dBodyVectorToWorld(_id, px, py, pz, result);
361 return LVecBase3f(result[0], result[1], result[2]);
365 vector_to_world(
const LVecBase3f &pos)
const {
366 return vector_to_world(pos[0], pos[1], pos[2]);
370 vector_from_world(dReal px, dReal py, dReal pz)
const {
372 dBodyVectorFromWorld(_id, px, py, pz, result);
373 return LVecBase3f(result[0], result[1], result[2]);
377 vector_from_world(
const LVecBase3f &pos)
const {
378 return vector_from_world(pos[0], pos[1], pos[2]);
381 INLINE
void OdeBody::
382 set_finite_rotation_mode(
int mode) {
383 dBodySetFiniteRotationMode(_id, mode);
386 INLINE
void OdeBody::
387 set_finite_rotation_axis(dReal x, dReal y, dReal z) {
388 dBodySetFiniteRotationAxis(_id, x, y, z);
391 INLINE
void OdeBody::
392 set_finite_rotation_axis(
const LVecBase3f &axis) {
393 set_finite_rotation_axis(axis[0], axis[1], axis[2]);
397 get_finite_rotation_mode()
const {
398 return dBodyGetFiniteRotationMode(_id);
402 get_finite_rotation_axis()
const {
404 dBodyGetFiniteRotationAxis(_id, result);
405 return LVecBase3f(result[0], result[1], result[2]);
409 get_num_joints()
const {
410 return dBodyGetNumJoints(_id);
413 INLINE
void OdeBody::
418 INLINE
void OdeBody::
425 return dBodyIsEnabled(_id);
428 INLINE
void OdeBody::
429 set_gravity_mode(
int mode) {
430 dBodySetGravityMode(_id, mode);
434 get_gravity_mode()
const {
435 return dBodyGetGravityMode(_id);
439 compare_to(
const OdeBody &other)
const {
440 if (_id != other._id) {
441 return _id < other._id ? -1 : 1;
This is the base class for all three-component vectors and points.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
dBodyID get_id() const
Returns the underlying dBodyID.
This is the base class for all three-component vectors and points.
This is the base quaternion class.
bool is_empty() const
Returns true if the ID is 0, meaning the OdeBody does not point to a valid body.
This is a 3-by-3 transform matrix.