33get_auto_disable_linear_threshold()
const {
34 return dBodyGetAutoDisableLinearThreshold(_id);
38set_auto_disable_linear_threshold(dReal linear_threshold) {
39 dBodySetAutoDisableLinearThreshold(_id, linear_threshold);
43get_auto_disable_angular_threshold()
const {
44 return dBodyGetAutoDisableAngularThreshold(_id);
48set_auto_disable_angular_threshold(dReal angular_threshold) {
49 dBodySetAutoDisableAngularThreshold(_id, angular_threshold);
53get_auto_disable_steps()
const {
54 return dBodyGetAutoDisableSteps(_id);
58set_auto_disable_steps(
int steps) {
59 dBodySetAutoDisableSteps(_id, steps);
63get_auto_disable_time()
const {
64 return dBodyGetAutoDisableTime(_id);
68set_auto_disable_time(dReal time) {
69 dBodySetAutoDisableTime(_id, time);
73get_auto_disable_flag()
const {
74 return dBodyGetAutoDisableFlag(_id);
78set_auto_disable_flag(
int do_auto_disable) {
79 dBodySetAutoDisableFlag(_id, do_auto_disable);
83set_auto_disable_defaults() {
84 dBodySetAutoDisableDefaults(_id);
89 dBodySetData(_id, data);
94 return dBodyGetData(_id);
98set_position(dReal x, dReal y, dReal z) {
99 dBodySetPosition(_id, x, y, z);
103set_position(
const LVecBase3f &pos) {
104 set_position(pos[0], pos[1], pos[2]);
108set_rotation(
const LMatrix3f &r) {
109 dMatrix3 mat3 = { r(0, 0), r(0, 1), r(0, 2), 0,
110 r(1, 0), r(1, 1), r(1, 2), 0,
111 r(2, 0), r(2, 1), r(2, 2), 0 };
113 dBodySetRotation(_id, mat3);
117set_quaternion(
const LQuaternionf &q) {
118 dQuaternion quat = { q[0], q[1], q[2], q[3] };
119 dBodySetQuaternion(_id, quat);
123set_linear_vel(dReal x, dReal y, dReal z) {
124 dBodySetLinearVel(_id, x, y, z);
128set_linear_vel(
const LVecBase3f &vel) {
129 set_linear_vel(vel[0], vel[1], vel[2]);
133set_angular_vel(dReal x, dReal y, dReal z) {
134 dBodySetAngularVel(_id, x, y, z);
138set_angular_vel(
const LVecBase3f &vel) {
139 set_angular_vel(vel[0], vel[1], vel[2]);
142INLINE LVecBase3f OdeBody::
143get_position()
const {
144 const dReal *res = dBodyGetPosition(_id);
145 return LVecBase3f(res[0], res[1], res[2]);
148INLINE LMatrix3f OdeBody::
149get_rotation()
const {
150 const dReal *rot = dBodyGetRotation(_id);
151 return LMatrix3f(rot[0], rot[1], rot[2],
152 rot[4], rot[5], rot[6],
153 rot[8], rot[9], rot[10]);
156INLINE LVecBase4f OdeBody::
157get_quaternion()
const {
158 const dReal *res = dBodyGetQuaternion(_id);
159 return LVecBase4f(res[0], res[1], res[2], res[3]);
162INLINE LVecBase3f OdeBody::
163get_linear_vel()
const {
164 const dReal *res = dBodyGetLinearVel(_id);
165 return LVecBase3f(res[0], res[1], res[2]);
168INLINE LVecBase3f OdeBody::
169get_angular_vel()
const {
170 const dReal *res = dBodyGetAngularVel(_id);
171 return LVecBase3f(res[0], res[1], res[2]);
176 dBodySetMass(_id, mass.get_mass_ptr());
182 dBodyGetMass(_id, mass.get_mass_ptr());
187add_force(dReal fx, dReal fy, dReal fz) {
188 dBodyAddForce(_id, fx, fy, fz);
192add_force(
const LVecBase3f &f) {
193 add_force(f[0], f[1], f[2]);
197add_torque(dReal fx, dReal fy, dReal fz) {
198 dBodyAddTorque(_id, fx, fy, fz);
202add_torque(
const LVecBase3f &f) {
203 add_torque(f[0], f[1], f[2]);
207add_rel_force(dReal fx, dReal fy, dReal fz) {
208 dBodyAddRelForce(_id, fx, fy, fz);
212add_rel_force(
const LVecBase3f &f) {
213 add_rel_force(f[0], f[1], f[2]);
217add_rel_torque(dReal fx, dReal fy, dReal fz) {
218 dBodyAddRelTorque(_id, fx, fy, fz);
222add_rel_torque(
const LVecBase3f &f) {
223 add_rel_torque(f[0], f[1], f[2]);
227add_force_at_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
228 dBodyAddForceAtPos(_id, fx, fy, fz, px, py, pz);
232add_force_at_pos(
const LVecBase3f &f,
const LVecBase3f &pos) {
233 add_force_at_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
237add_force_at_rel_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
238 dBodyAddForceAtRelPos(_id, fx, fy, fz, px, py, pz);
242add_force_at_rel_pos(
const LVecBase3f &f,
const LVecBase3f &pos) {
243 add_force_at_rel_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
247add_rel_force_at_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
248 dBodyAddRelForceAtPos(_id, fx, fy, fz, px, py, pz);
252add_rel_force_at_pos(
const LVecBase3f &f,
const LVecBase3f &pos) {
253 add_rel_force_at_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
257add_rel_force_at_rel_pos(dReal fx, dReal fy, dReal fz, dReal px, dReal py, dReal pz) {
258 dBodyAddRelForceAtRelPos(_id, fx, fy, fz, px, py, pz);
262add_rel_force_at_rel_pos(
const LVecBase3f &f,
const LVecBase3f &pos) {
263 add_rel_force_at_rel_pos(f[0], f[1], f[2], pos[0], pos[1], pos[2]);
267set_force(dReal x, dReal y, dReal z) {
268 dBodySetForce(_id, x, y, z);
272set_force(
const LVecBase3f &f) {
273 set_force(f[0], f[1], f[2]);
277set_torque(dReal x, dReal y, dReal z) {
278 dBodySetTorque(_id, x, y, z);
282set_torque(
const LVecBase3f &f) {
283 set_torque(f[0], f[1], f[2]);
286INLINE LPoint3f OdeBody::
287get_rel_point_pos(dReal px, dReal py, dReal pz)
const {
289 dBodyGetRelPointPos(_id, px, py, pz, result);
290 return LPoint3f(result[0], result[1], result[2]);
293INLINE LPoint3f OdeBody::
294get_rel_point_pos(
const LVecBase3f &pos)
const {
295 return get_rel_point_pos(pos[0], pos[1], pos[2]);
298INLINE LPoint3f OdeBody::
299get_rel_point_vel(dReal px, dReal py, dReal pz)
const {
301 dBodyGetRelPointVel(_id, px, py, pz, result);
302 return LPoint3f(result[0], result[1], result[2]);
305INLINE LPoint3f OdeBody::
306get_rel_point_vel(
const LVecBase3f &pos)
const {
307 return get_rel_point_vel(pos[0], pos[1], pos[2]);
310INLINE LPoint3f OdeBody::
311get_point_vel(dReal px, dReal py, dReal pz)
const {
313 dBodyGetPointVel(_id, px, py, pz, result);
314 return LPoint3f(result[0], result[1], result[2]);
317INLINE LPoint3f OdeBody::
318get_point_vel(
const LVecBase3f &pos)
const {
319 return get_point_vel(pos[0], pos[1], pos[2]);
322INLINE LPoint3f OdeBody::
323get_pos_rel_point(dReal px, dReal py, dReal pz)
const {
325 dBodyGetPosRelPoint(_id, px, py, pz, result);
326 return LPoint3f(result[0], result[1], result[2]);
329INLINE LPoint3f OdeBody::
330get_pos_rel_point(
const LVecBase3f &pos)
const {
331 return get_pos_rel_point(pos[0], pos[1], pos[2]);
334INLINE LVecBase3f OdeBody::
335vector_to_world(dReal px, dReal py, dReal pz)
const {
337 dBodyVectorToWorld(_id, px, py, pz, result);
338 return LVecBase3f(result[0], result[1], result[2]);
341INLINE LVecBase3f OdeBody::
342vector_to_world(
const LVecBase3f &pos)
const {
343 return vector_to_world(pos[0], pos[1], pos[2]);
346INLINE LVecBase3f OdeBody::
347vector_from_world(dReal px, dReal py, dReal pz)
const {
349 dBodyVectorFromWorld(_id, px, py, pz, result);
350 return LVecBase3f(result[0], result[1], result[2]);
353INLINE LVecBase3f OdeBody::
354vector_from_world(
const LVecBase3f &pos)
const {
355 return vector_from_world(pos[0], pos[1], pos[2]);
359set_finite_rotation_mode(
int mode) {
360 dBodySetFiniteRotationMode(_id, mode);
364set_finite_rotation_axis(dReal x, dReal y, dReal z) {
365 dBodySetFiniteRotationAxis(_id, x, y, z);
369set_finite_rotation_axis(
const LVecBase3f &axis) {
370 set_finite_rotation_axis(axis[0], axis[1], axis[2]);
374get_finite_rotation_mode()
const {
375 return dBodyGetFiniteRotationMode(_id);
378INLINE LVecBase3f OdeBody::
379get_finite_rotation_axis()
const {
381 dBodyGetFiniteRotationAxis(_id, result);
382 return LVecBase3f(result[0], result[1], result[2]);
386get_num_joints()
const {
387 return dBodyGetNumJoints(_id);
402 return dBodyIsEnabled(_id);
406set_gravity_mode(
int mode) {
407 dBodySetGravityMode(_id, mode);
411get_gravity_mode()
const {
412 return dBodyGetGravityMode(_id);
416compare_to(
const OdeBody &other)
const {
417 if (_id != other._id) {
418 return _id < other._id ? -1 : 1;
dBodyID get_id() const
Returns the underlying dBodyID.
bool is_empty() const
Returns true if the ID is 0, meaning the OdeBody does not point to a valid body.