mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Adding a bunch of methods for different constraints.
This commit is contained in:
parent
31f9a697b0
commit
878486712f
@ -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));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user