Rope: Don't apply repulsive forces on rope segments

rope
Armin Burgmeier 2012-04-29 16:21:22 +02:00
parent bd45ae0fab
commit 886b1e254b
2 changed files with 5 additions and 1 deletions

View File

@ -299,7 +299,7 @@ void C4Rope::Solve(TRopeType1* prev, TRopeType2* next) //C4RopeSegment* prev, C4
// TODO: Could also use an approximation which works without Sqrt, especially
// if this becomes a performance bottleneck. http://www.azillionmonkeys.com/qed/sqroot.html
C4Real d = ftofix(sqrt(fixtof(dx*dx + dy*dy)));
if(d != 0)
if(d != 0 && (ApplyRepulsive || d > l))
{
fx += (dx / d) * k * (d - l);
fy += (dy / d) * k * (d - l);

View File

@ -107,6 +107,10 @@ private:
template<typename TRopeType1, typename TRopeType2>
void Solve(TRopeType1* prev, TRopeType2* next);
// Whether to apply repulsive forces between rope segments.
// TODO: Could be made a property...
static const bool ApplyRepulsive = false;
const float w; // Width of rope
C4DefGraphics* Graphics;