@@ -1215,9 +1215,10 @@ float AtomGroup::Travel(Vector &position,
1215
1215
1216
1216
// TERRAIN COLLISION RESPONSE /////////////////////////////////////////////////////
1217
1217
// Determine which of the colliding Atom:s will penetrate the terrain.
1218
- do
1218
+ bool somethingPenetrated = false ;
1219
+ do
1219
1220
{
1220
- penetratingAtoms. clear () ;
1221
+ somethingPenetrated = false ;
1221
1222
1222
1223
distMass = mass / static_cast <float >(hitTerrAtoms.size () * (m_Resolution ? m_Resolution : 1 ));
1223
1224
distMI = m_MomInertia / static_cast <float >(hitTerrAtoms.size () * (m_Resolution ? m_Resolution : 1 ));
@@ -1242,11 +1243,12 @@ float AtomGroup::Travel(Vector &position,
1242
1243
// Move the penetrating atom to the pen. list from the coll. list.
1243
1244
penetratingAtoms.push_back (*aItr);
1244
1245
aItr = hitTerrAtoms.erase (aItr);
1246
+ somethingPenetrated = true ;
1245
1247
} else
1246
1248
++aItr;
1247
1249
}
1248
1250
}
1249
- while (!hitTerrAtoms.empty () && !penetratingAtoms. empty () );
1251
+ while (!hitTerrAtoms.empty () && somethingPenetrated );
1250
1252
1251
1253
// TERRAIN BOUNCE //////////////////////////////////////////////////////////////////
1252
1254
// If some Atoms could not penetrate even though all the impulse was on them,
@@ -1937,8 +1939,9 @@ before adding them to the MovableMan.
1937
1939
1938
1940
// TERRAIN COLLISION RESPONSE /////////////////////////////////////////////////////
1939
1941
// Determine which of the colliding Atom:s will penetrate the terrain.
1942
+ bool somethingPenetrated = false ;
1940
1943
do {
1941
- penetratingAtoms. clear () ;
1944
+ somethingPenetrated = false ;
1942
1945
1943
1946
massDist = mass / static_cast <float >(hitTerrAtoms.size () * (m_Resolution ? m_Resolution : 1 ));
1944
1947
@@ -1952,11 +1955,12 @@ before adding them to the MovableMan.
1952
1955
// Move the penetrating atom to the pen. list from the coll. list.
1953
1956
penetratingAtoms.push_back (pair<Atom *, Vector>((*aoItr).first , (*aoItr).second ));
1954
1957
aoItr = hitTerrAtoms.erase (aoItr);
1958
+ somethingPenetrated = true ;
1955
1959
}
1956
1960
else
1957
1961
++aoItr;
1958
1962
}
1959
- } while (!hitTerrAtoms.empty () && !penetratingAtoms. empty () );
1963
+ } while (!hitTerrAtoms.empty () && somethingPenetrated );
1960
1964
1961
1965
// TERRAIN BOUNCE //////////////////////////////////////////////////////////////////
1962
1966
// If some Atom:s could not penetrate even though all the mass was on them,
0 commit comments