mirror of
https://github.com/bulletphysics/bullet3
synced 2025-01-18 21:10:05 +00:00
support gravity factor for deformables
This commit is contained in:
parent
5233b72160
commit
e89903a8ab
@ -68,7 +68,7 @@ public:
|
||||
btSoftBody::Node& n = psb->m_nodes[j];
|
||||
size_t id = n.index;
|
||||
btScalar mass = (n.m_im == 0) ? 0 : 1. / n.m_im;
|
||||
btVector3 scaled_force = scale * m_gravity * mass;
|
||||
btVector3 scaled_force = scale * m_gravity * mass * m_softBodies[i]->m_gravityFactor;
|
||||
force[id] += scaled_force;
|
||||
}
|
||||
}
|
||||
|
@ -228,6 +228,7 @@ void btSoftBody::initDefaults()
|
||||
m_softSoftCollision = false;
|
||||
m_maxSpeedSquared = 0;
|
||||
m_repulsionStiffness = 0.5;
|
||||
m_gravityFactor = 1;
|
||||
m_fdbvnt = 0;
|
||||
}
|
||||
|
||||
@ -3426,6 +3427,11 @@ void btSoftBody::setSpringStiffness(btScalar k)
|
||||
m_repulsionStiffness = k;
|
||||
}
|
||||
|
||||
void btSoftBody::setGravityFactor(btScalar gravFactor)
|
||||
{
|
||||
m_gravityFactor = gravFactor;
|
||||
}
|
||||
|
||||
void btSoftBody::initializeDmInverse()
|
||||
{
|
||||
btScalar unit_simplex_measure = 1./6.;
|
||||
|
@ -821,6 +821,7 @@ public:
|
||||
btScalar m_maxSpeedSquared;
|
||||
btAlignedObjectArray<btVector3> m_quads; // quadrature points for collision detection
|
||||
btScalar m_repulsionStiffness;
|
||||
btScalar m_gravityFactor;
|
||||
btAlignedObjectArray<btVector3> m_X; // initial positions
|
||||
|
||||
btAlignedObjectArray<btVector4> m_renderNodesInterpolationWeights;
|
||||
@ -1168,6 +1169,7 @@ public:
|
||||
void applyClusters(bool drift);
|
||||
void dampClusters();
|
||||
void setSpringStiffness(btScalar k);
|
||||
void setGravityFactor(btScalar gravFactor);
|
||||
void initializeDmInverse();
|
||||
void updateDeformation();
|
||||
void advanceDeformation();
|
||||
|
Loading…
Reference in New Issue
Block a user