From 907872267ab1fbdc6518d3cb2d7a3d3a356a6917 Mon Sep 17 00:00:00 2001 From: enn0x Date: Sun, 15 Apr 2012 22:44:17 +0000 Subject: [PATCH] Added get/set_param --- panda/src/bullet/bulletConstraint.cxx | 22 ++++++++++++++++++++++ panda/src/bullet/bulletConstraint.h | 10 ++++++++++ 2 files changed, 32 insertions(+) diff --git a/panda/src/bullet/bulletConstraint.cxx b/panda/src/bullet/bulletConstraint.cxx index 73041d5dcb..f0fd43042e 100644 --- a/panda/src/bullet/bulletConstraint.cxx +++ b/panda/src/bullet/bulletConstraint.cxx @@ -83,3 +83,25 @@ get_rigid_body_b() { return (BulletRigidBodyNode *)ptr()->getRigidBodyB().getUserPointer(); } +//////////////////////////////////////////////////////////////////// +// Function: BulletConstraint::set_param +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletConstraint:: +set_param(ConstraintParam num, PN_stdfloat value, int axis) { + + ptr()->setParam((btConstraintParams)num, (btScalar)value, axis); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConstraint::get_param +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +PN_stdfloat BulletConstraint:: +get_param(ConstraintParam num, int axis) { + + return (PN_stdfloat)ptr()->getParam((btConstraintParams)num, axis); +} + diff --git a/panda/src/bullet/bulletConstraint.h b/panda/src/bullet/bulletConstraint.h index 539b1d71be..75962e3612 100644 --- a/panda/src/bullet/bulletConstraint.h +++ b/panda/src/bullet/bulletConstraint.h @@ -41,6 +41,16 @@ PUBLISHED: PN_stdfloat get_applied_impulse() const; PN_stdfloat get_debug_draw_size(); + enum ConstraintParam { + CP_erp = 1, + CP_stop_erp, + CP_cfm, + CP_stop_cfm + }; + + void set_param(ConstraintParam num, PN_stdfloat value, int axis=-1); + PN_stdfloat get_param(ConstraintParam num, int axis=-1); + public: virtual btTypedConstraint *ptr() const = 0;