Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoumya Pochirau <soumya.pochiraju@gmail.com>2022-02-15 19:35:47 +0300
committerSoumya Pochirau <soumya.pochiraju@gmail.com>2022-02-15 19:35:47 +0300
commitf5dd77d290fb35ff0fe78b50efed34817bc66f51 (patch)
tree57134d69c6e19c7f0a2f8e470e31f090d3903e1e
parentad35f6181ef90296c2aa09a0f813530b2b78bc1d (diff)
Added comments to RB_dworld_get_impulse to better explain the bullet terminologies
-rw-r--r--intern/rigidbody/rb_bullet_api.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/intern/rigidbody/rb_bullet_api.cpp b/intern/rigidbody/rb_bullet_api.cpp
index 3dfbcd6ba8c..99f6eb24c70 100644
--- a/intern/rigidbody/rb_bullet_api.cpp
+++ b/intern/rigidbody/rb_bullet_api.cpp
@@ -220,13 +220,16 @@ void RB_dworld_get_impulse(rbDynamicsWorld *world,
int num_norm_forces = 0;
int num_fric_forces = 0;
- /*Loop thrhough all persisent contact manifolds. */
+ /* Loop through all persisent contact manifolds. The persistant manifold contains all contact points between
+ * 2 overlapping objects in the world. It can contain between 0 and 4 points. This is the contact point cache
+ * after reduction of the contact manifold. */
for (int i = 0; i < numManifolds; i++) {
btPersistentManifold *contactManifold = world->dispatcher->getManifoldByIndexInternal(i);
+ /* The 2 overlapping obejcts. */
const void *obA = contactManifold->getBody0();
const void *obB = contactManifold->getBody1();
- /* Break if we cannot store any more forces. */
+ /* Break if we cannot store any more forces. upperlimit is 3 */
/* Friction cannot exist without a normal force, so counting number of normal forces stored is enough. */
if (num_norm_forces > 2) {
break;
@@ -250,7 +253,8 @@ void RB_dworld_get_impulse(rbDynamicsWorld *world,
}
}
- /* Loop throught contact points and add impulses applied at each point. */
+ /* Loop throught contact points and add impulses applied at each point.
+ * Devide by time to get the equivilant force. */
for (int j = 0; j < numContacts; j++) {
btManifoldPoint &pt = contactManifold->getContactPoint(j);
if (pt.getAppliedImpulse() > 0.f || -pt.getAppliedImpulse() > 0.f) {
@@ -277,7 +281,7 @@ void RB_dworld_get_impulse(rbDynamicsWorld *world,
}
}
/* If impulse was applied at more than one point, the location of the force is taken as average of points
- * weighted by magnitude of impulse applied at each point. */
+ * weighted by the magnitude of impulse applied at each point. */
if(fabsf(tot_impulse_magnitude)==0.0f){
continue;
}