mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 17:35:34 -04:00
Bullet: getTotalForce/Torque exposed
This commit is contained in:
parent
297864e834
commit
3830ef2f85
@ -122,11 +122,22 @@ PN_stdfloat BulletRigidBodyNode::
|
||||
get_mass() const {
|
||||
|
||||
btScalar inv_mass = _rigid->getInvMass();
|
||||
btScalar mass = inv_mass == btScalar(0.0) ? btScalar(0.0) : btScalar(1.0) / inv_mass;
|
||||
btScalar mass = (inv_mass == btScalar(0.0)) ? btScalar(0.0) : btScalar(1.0) / inv_mass;
|
||||
|
||||
return mass;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletRigidBodyNode::get_inv_mass
|
||||
// Access: Published
|
||||
// Description: Returns the inverse mass of a rigid body.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
PN_stdfloat BulletRigidBodyNode::
|
||||
get_inv_mass() const {
|
||||
|
||||
return (PN_stdfloat)_rigid->getInvMass();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletRigidBodyNode::set_inertia
|
||||
// Access: Published
|
||||
@ -177,6 +188,28 @@ get_inertia() const {
|
||||
return inertia;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletRigidBodyNode::get_inv_inertia_diag_local
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
LVector3 BulletRigidBodyNode::
|
||||
get_inv_inertia_diag_local() const {
|
||||
|
||||
return btVector3_to_LVector3(_rigid->getInvInertiaDiagLocal());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletRigidBodyNode::get_inv_inertia_tensor_world
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
LMatrix3 BulletRigidBodyNode::
|
||||
get_inv_inertia_tensor_world() const {
|
||||
|
||||
return btMatrix3x3_to_LMatrix3(_rigid->getInvInertiaTensorWorld());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletRigidBodyNode::apply_force
|
||||
// Access: Published
|
||||
@ -479,6 +512,28 @@ set_angular_factor(const LVector3 &factor) {
|
||||
_rigid->setAngularFactor(LVecBase3_to_btVector3(factor));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletRigidBodyNode::get_total_force
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
LVector3 BulletRigidBodyNode::
|
||||
get_total_force() const {
|
||||
|
||||
return btVector3_to_LVector3(_rigid->getTotalForce());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletRigidBodyNode::get_total_torque
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
LVector3 BulletRigidBodyNode::
|
||||
get_total_torque() const {
|
||||
|
||||
return btVector3_to_LVector3(_rigid->getTotalTorque());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: BulletRigidBodyNode::MotionState::Constructor
|
||||
// Access: Public
|
||||
|
@ -39,8 +39,11 @@ PUBLISHED:
|
||||
// Mass & inertia
|
||||
void set_mass(PN_stdfloat mass);
|
||||
PN_stdfloat get_mass() const;
|
||||
PN_stdfloat get_inv_mass() const;
|
||||
void set_inertia(const LVecBase3 &inertia);
|
||||
LVector3 get_inertia() const;
|
||||
LVector3 get_inv_inertia_diag_local() const;
|
||||
LMatrix3 get_inv_inertia_tensor_world() const;
|
||||
|
||||
// Velocity
|
||||
LVector3 get_linear_velocity() const;
|
||||
@ -63,6 +66,9 @@ PUBLISHED:
|
||||
void apply_torque(const LVector3 &torque);
|
||||
void apply_torque_impulse(const LVector3 &torque);
|
||||
|
||||
LVector3 get_total_force() const;
|
||||
LVector3 get_total_torque() const;
|
||||
|
||||
// Deactivation thresholds
|
||||
PN_stdfloat get_linear_sleep_threshold() const;
|
||||
PN_stdfloat get_angular_sleep_threshold() const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user