diff --git a/panda/src/bullet/bulletConeTwistConstraint.cxx b/panda/src/bullet/bulletConeTwistConstraint.cxx index d53ff48b84..9f1af9303a 100644 --- a/panda/src/bullet/bulletConeTwistConstraint.cxx +++ b/panda/src/bullet/bulletConeTwistConstraint.cxx @@ -93,3 +93,91 @@ set_limit(float swing1, float swing2, float twist, float softness, float bias, f _constraint->setLimit(swing1, swing2, twist, softness, bias, relaxation); } +//////////////////////////////////////////////////////////////////// +// Function: BulletConeTwistConstraint::set_damping +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletConeTwistConstraint:: +set_damping(float damping) { + + _constraint->setDamping(damping); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConeTwistConstraint::get_fix_threshold +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +float BulletConeTwistConstraint:: +get_fix_threshold() const { + + return _constraint->getFixThresh(); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConeTwistConstraint::set_fix_threshold +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletConeTwistConstraint:: +set_fix_threshold(float threshold) { + + _constraint->setFixThresh(threshold); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConeTwistConstraint::enable_motor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletConeTwistConstraint:: +enable_motor(bool enable) { + + _constraint->enableMotor(enable); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConeTwistConstraint::set_max_motor_impulse +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletConeTwistConstraint:: +set_max_motor_impulse(float max_impulse) { + + _constraint->setMaxMotorImpulse(max_impulse); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConeTwistConstraint::set_max_motor_impulse_normalized +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletConeTwistConstraint:: +set_max_motor_impulse_normalized(float max_impulse) { + + _constraint->setMaxMotorImpulseNormalized(max_impulse); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConeTwistConstraint::set_motor_target +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletConeTwistConstraint:: +set_motor_target(const LQuaternionf &quat) { + + _constraint->setMotorTarget(LQuaternionf_to_btQuat(quat)); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConeTwistConstraint::set_motor_target_in_constraint_space +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletConeTwistConstraint:: +set_motor_target_in_constraint_space(const LQuaternionf &quat) { + + _constraint->setMotorTargetInConstraintSpace(LQuaternionf_to_btQuat(quat)); +} + diff --git a/panda/src/bullet/bulletConeTwistConstraint.h b/panda/src/bullet/bulletConeTwistConstraint.h index fec6a2fc93..33c216383d 100644 --- a/panda/src/bullet/bulletConeTwistConstraint.h +++ b/panda/src/bullet/bulletConeTwistConstraint.h @@ -43,6 +43,17 @@ PUBLISHED: void set_limit(int index, float value); void set_limit(float swing1, float swing2, float twist, float softness=1.0f, float bias=0.3f, float relaxation=1.0f); + void set_damping(float damping); + + float get_fix_threshold() const; + void set_fix_threshold(float threshold); + + void enable_motor(bool enable); + void set_max_motor_impulse(float max_impulse); + void set_max_motor_impulse_normalized(float max_impulse); + void set_motor_target(const LQuaternionf &quat); + void set_motor_target_in_constraint_space(const LQuaternionf &quat); + public: virtual btTypedConstraint *ptr() const; diff --git a/panda/src/bullet/bulletHingeConstraint.cxx b/panda/src/bullet/bulletHingeConstraint.cxx index 8464a722a6..fd01acded3 100644 --- a/panda/src/bullet/bulletHingeConstraint.cxx +++ b/panda/src/bullet/bulletHingeConstraint.cxx @@ -156,3 +156,58 @@ get_hinge_angle() { return rad_2_deg(_constraint->getHingeAngle()); } +//////////////////////////////////////////////////////////////////// +// Function: BulletHingeConstraint::enable_angular_motor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletHingeConstraint:: +enable_angular_motor(bool enable, float target_velocity, float max_impulse) { + + _constraint->enableAngularMotor(enable, target_velocity, max_impulse); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletHingeConstraint::enable_motor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletHingeConstraint:: +enable_motor(bool enable) { + + _constraint->enableMotor(enable); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletHingeConstraint::set_max_motor_impulse +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletHingeConstraint:: +set_max_motor_impulse(float max_impulse) { + + _constraint->setMaxMotorImpulse(max_impulse); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletHingeConstraint::set_motor_target +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletHingeConstraint:: +set_motor_target(const LQuaternionf &quat, float dt) { + + _constraint->setMotorTarget(LQuaternionf_to_btQuat(quat), dt); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletHingeConstraint::set_motor_target +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletHingeConstraint:: +set_motor_target(float target_angle, float dt) { + + _constraint->setMotorTarget(target_angle, dt); +} + diff --git a/panda/src/bullet/bulletHingeConstraint.h b/panda/src/bullet/bulletHingeConstraint.h index 1ec6b2c7c0..f36528f3e1 100644 --- a/panda/src/bullet/bulletHingeConstraint.h +++ b/panda/src/bullet/bulletHingeConstraint.h @@ -23,6 +23,7 @@ #include "lpoint3.h" #include "lvector3.h" +#include "lquaternion.h" class BulletRigidBodyNode; @@ -55,6 +56,12 @@ PUBLISHED: void set_limit(float low, float high, float softness=0.9f, float bias=0.3f, float relaxation=1.0f); void set_axis(const LVector3f &axis); + void enable_angular_motor(bool enable, float target_velocity, float max_impulse); + void enable_motor(bool enable); + void set_max_motor_impulse(float max_impulse); + void set_motor_target(const LQuaternionf &quat, float dt); + void set_motor_target(float target_angle, float dt); + public: virtual btTypedConstraint *ptr() const; diff --git a/panda/src/bullet/bulletSliderConstraint.cxx b/panda/src/bullet/bulletSliderConstraint.cxx index c72202d3fb..fa9468a2d5 100644 --- a/panda/src/bullet/bulletSliderConstraint.cxx +++ b/panda/src/bullet/bulletSliderConstraint.cxx @@ -73,7 +73,7 @@ ptr() const { // Description: //////////////////////////////////////////////////////////////////// float BulletSliderConstraint:: -get_lower_linear_limit() { +get_lower_linear_limit() const { return _constraint->getLowerLinLimit(); } @@ -84,7 +84,7 @@ get_lower_linear_limit() { // Description: //////////////////////////////////////////////////////////////////// float BulletSliderConstraint:: -get_upper_linear_limit() { +get_upper_linear_limit() const { return _constraint->getUpperLinLimit(); } @@ -95,7 +95,7 @@ get_upper_linear_limit() { // Description: //////////////////////////////////////////////////////////////////// float BulletSliderConstraint:: -get_lower_angular_limit() { +get_lower_angular_limit() const { return rad_2_deg(_constraint->getLowerAngLimit()); } @@ -106,7 +106,7 @@ get_lower_angular_limit() { // Description: //////////////////////////////////////////////////////////////////// float BulletSliderConstraint:: -get_upper_angular_limit() { +get_upper_angular_limit() const { return rad_2_deg(_constraint->getUpperAngLimit()); } @@ -155,3 +155,157 @@ set_upper_angular_limit(float value) { _constraint->setUpperAngLimit(deg_2_rad(value)); } +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::get_linear_pos +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +float BulletSliderConstraint:: +get_linear_pos() const { + + return _constraint->getLinearPos(); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::get_angular_pos +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +float BulletSliderConstraint:: +get_angular_pos() const { + + return _constraint->getAngularPos(); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::set_powered_linear_motor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletSliderConstraint:: +set_powered_linear_motor(bool on) { + + _constraint->setPoweredLinMotor(on); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::set_target_linear_motor_velocity +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletSliderConstraint:: +set_target_linear_motor_velocity(float target_velocity) { + + _constraint->setTargetLinMotorVelocity(target_velocity); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::set_max_linear_motor_force +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletSliderConstraint:: +set_max_linear_motor_force(float max_force) { + + _constraint->setMaxLinMotorForce(max_force); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::get_powered_linear_motor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +bool BulletSliderConstraint:: +get_powered_linear_motor() const { + + return _constraint->getPoweredLinMotor(); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::get_target_linear_motor_velocity +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +float BulletSliderConstraint:: +get_target_linear_motor_velocity() const { + + return _constraint->getTargetLinMotorVelocity(); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::get_max_linear_motor_force +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +float BulletSliderConstraint:: +get_max_linear_motor_force() const { + + return _constraint->getMaxLinMotorForce(); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::set_powered_angular_motor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletSliderConstraint:: +set_powered_angular_motor(bool on) { + + _constraint->setPoweredAngMotor(on); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::set_target_angular_motor_velocity +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletSliderConstraint:: +set_target_angular_motor_velocity(float target_velocity) { + + _constraint->setTargetAngMotorVelocity(target_velocity); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::set_max_angular_motor_force +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void BulletSliderConstraint:: +set_max_angular_motor_force(float max_force) { + + _constraint->setMaxAngMotorForce(max_force); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::get_powered_angular_motor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +bool BulletSliderConstraint:: +get_powered_angular_motor() const { + + return _constraint->getPoweredAngMotor(); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::get_target_angular_motor_velocity +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +float BulletSliderConstraint:: +get_target_angular_motor_velocity() const { + + return _constraint->getTargetAngMotorVelocity(); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSliderConstraint::get_max_angular_motor_force +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +float BulletSliderConstraint:: +get_max_angular_motor_force() const { + + return _constraint->getMaxAngMotorForce(); +} + diff --git a/panda/src/bullet/bulletSliderConstraint.h b/panda/src/bullet/bulletSliderConstraint.h index 53a43d0b62..1373e13db1 100644 --- a/panda/src/bullet/bulletSliderConstraint.h +++ b/panda/src/bullet/bulletSliderConstraint.h @@ -42,16 +42,35 @@ PUBLISHED: bool use_frame_a); INLINE ~BulletSliderConstraint(); - float get_lower_linear_limit(); - float get_upper_linear_limit(); - float get_lower_angular_limit(); - float get_upper_angular_limit(); + float get_linear_pos() const; + float get_angular_pos() const; + // Limits + float get_lower_linear_limit() const; + float get_upper_linear_limit() const; + float get_lower_angular_limit() const; + float get_upper_angular_limit() const; void set_lower_linear_limit(float value); void set_upper_linear_limit(float value); void set_lower_angular_limit(float value); void set_upper_angular_limit(float value); + // Linear motor + void set_powered_linear_motor(bool on); + void set_target_linear_motor_velocity (float target_velocity); + void set_max_linear_motor_force(float max_force); + bool get_powered_linear_motor() const; + float get_target_linear_motor_velocity() const; + float get_max_linear_motor_force() const; + + // Angular motor + void set_powered_angular_motor(bool on); + void set_target_angular_motor_velocity (float target_velocity); + void set_max_angular_motor_force(float max_force); + bool get_powered_angular_motor() const; + float get_target_angular_motor_velocity() const; + float get_max_angular_motor_force() const; + public: virtual btTypedConstraint *ptr() const;