mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
Bullet: experimental support for linear/angular soft body joints
This commit is contained in:
parent
cbbe02f879
commit
a2a0b485ac
@ -217,6 +217,28 @@ set_friction(PN_stdfloat friction) {
|
|||||||
return get_object()->setFriction(friction);
|
return get_object()->setFriction(friction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BulletBodyNode::get_rolling_friction
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE PN_stdfloat BulletBodyNode::
|
||||||
|
get_rolling_friction() const {
|
||||||
|
|
||||||
|
return get_object()->getRollingFriction();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BulletBodyNode::set_rolling_friction
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void BulletBodyNode::
|
||||||
|
set_rolling_friction(PN_stdfloat friction) {
|
||||||
|
|
||||||
|
return get_object()->setRollingFriction(friction);
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: BulletBodyNode::has_anisotropic_friction
|
// Function: BulletBodyNode::has_anisotropic_friction
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -680,7 +680,7 @@ append_anchor(int node, BulletRigidBodyNode *body, bool disable) {
|
|||||||
|
|
||||||
body->sync_p2b();
|
body->sync_p2b();
|
||||||
|
|
||||||
btRigidBody *ptr =(btRigidBody *)body->get_object();
|
btRigidBody *ptr = (btRigidBody *)body->get_object();
|
||||||
_soft->appendAnchor(node, ptr, disable);
|
_soft->appendAnchor(node, ptr, disable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,7 +698,7 @@ append_anchor(int node, BulletRigidBodyNode *body, const LVector3 &pivot, bool d
|
|||||||
|
|
||||||
body->sync_p2b();
|
body->sync_p2b();
|
||||||
|
|
||||||
btRigidBody *ptr =(btRigidBody *)body->get_object();
|
btRigidBody *ptr = (btRigidBody *)body->get_object();
|
||||||
_soft->appendAnchor(node, ptr, LVecBase3_to_btVector3(pivot), disable);
|
_soft->appendAnchor(node, ptr, LVecBase3_to_btVector3(pivot), disable);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1070,3 +1070,66 @@ make_tet_mesh(BulletSoftBodyWorldInfo &info, const char *ele, const char *face,
|
|||||||
return sbnode;
|
return sbnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BulletSoftBodyNode::append_linear_joint
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void BulletSoftBodyNode::
|
||||||
|
append_linear_joint(BulletBodyNode *body, int cluster, PN_stdfloat erp, PN_stdfloat cfm, PN_stdfloat split) {
|
||||||
|
|
||||||
|
nassertv(body);
|
||||||
|
|
||||||
|
btCollisionObject *ptr = body->get_object();
|
||||||
|
|
||||||
|
btSoftBody::LJoint::Specs ls;
|
||||||
|
ls.erp = erp;
|
||||||
|
ls.cfm = cfm;
|
||||||
|
ls.split = split;
|
||||||
|
ls.position = _soft->clusterCom(cluster);
|
||||||
|
|
||||||
|
_soft->appendLinearJoint(ls, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BulletSoftBodyNode::append_linear_joint
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void BulletSoftBodyNode::
|
||||||
|
append_linear_joint(BulletBodyNode *body, const LPoint3 &pos, PN_stdfloat erp, PN_stdfloat cfm, PN_stdfloat split) {
|
||||||
|
|
||||||
|
nassertv(body);
|
||||||
|
|
||||||
|
btCollisionObject *ptr = body->get_object();
|
||||||
|
|
||||||
|
btSoftBody::LJoint::Specs ls;
|
||||||
|
ls.erp = erp;
|
||||||
|
ls.cfm = cfm;
|
||||||
|
ls.split = split;
|
||||||
|
ls.position = LVecBase3_to_btVector3(pos);
|
||||||
|
|
||||||
|
_soft->appendLinearJoint(ls, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BulletSoftBodyNode::append_angular_joint
|
||||||
|
// Access: Published
|
||||||
|
// Description:
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
void BulletSoftBodyNode::
|
||||||
|
append_angular_joint(BulletBodyNode *body, const LVector3 &axis, PN_stdfloat erp, PN_stdfloat cfm, PN_stdfloat split) {
|
||||||
|
|
||||||
|
nassertv(body);
|
||||||
|
|
||||||
|
btCollisionObject *ptr = body->get_object();
|
||||||
|
|
||||||
|
btSoftBody::AJoint::Specs as;
|
||||||
|
as.erp = erp;
|
||||||
|
as.cfm = cfm;
|
||||||
|
as.split = split;
|
||||||
|
as.axis = LVecBase3_to_btVector3(axis);
|
||||||
|
|
||||||
|
_soft->appendAngularJoint(as, ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,22 @@ PUBLISHED:
|
|||||||
const LVector3 &pivot,
|
const LVector3 &pivot,
|
||||||
bool disable=false);
|
bool disable=false);
|
||||||
|
|
||||||
|
// Links
|
||||||
|
void append_linear_joint(BulletBodyNode *body, int cluster,
|
||||||
|
PN_stdfloat erp=1.0,
|
||||||
|
PN_stdfloat cfm=1.0,
|
||||||
|
PN_stdfloat split=1.0);
|
||||||
|
|
||||||
|
void append_linear_joint(BulletBodyNode *body, const LPoint3 &pos,
|
||||||
|
PN_stdfloat erp=1.0,
|
||||||
|
PN_stdfloat cfm=1.0,
|
||||||
|
PN_stdfloat split=1.0);
|
||||||
|
|
||||||
|
void append_angular_joint(BulletBodyNode *body, const LVector3 &axis,
|
||||||
|
PN_stdfloat erp=1.0,
|
||||||
|
PN_stdfloat cfm=1.0,
|
||||||
|
PN_stdfloat split=1.0);
|
||||||
|
|
||||||
// Materials
|
// Materials
|
||||||
int get_num_materials() const;
|
int get_num_materials() const;
|
||||||
BulletSoftBodyMaterial get_material(int idx) const;
|
BulletSoftBodyMaterial get_material(int idx) const;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user