How to Create a Non-Stretchable Rope with Havok

Hello @YongKang_Yang and welcome !

I would say : yes it is ! :slight_smile:

Havok is solving the physics iteratively, and by definition the constraint will never be “respected” because it’s basically waiting for it to be “out of law” (ex: distance constraint out of bound) to “solve” this by “slightly pushing” the joints toward the right place. Then it adds a damping effect so that things don’t go crazy.


In order to better understand you can have a look at my project with Custom wire physics using GreasedLines and have a look a the custom (no Havok) physics :

// Gravity
this.speed.y -= GRAVITY;
// Apply forces for all linked joints
for (const [joint, dist] of this.links) {
    const d = this.pos.subtract(joint.pos).length();
    if (d !== dist) {
        const dir = joint.pos.subtract(this.pos).normalize();
        const pos_ = this.pos.add(dir.scale(d-dist));
        this.speed.addInPlace(pos_.subtract(this.pos).scale(ELASTICITY));
    }
}
// Damping effect
this.speed.scaleInPlace(Math.max(0.5, 1.0-DAMPING*Math.pow(this.speed.length(), 0.2)));

It’s not exactly Havok, but the principle is very close :

  • Gravity
  • if (d !== dist) → act on joint if constraint is not OK
  • Damping

Now, about solving your issue :

  • Gravity acts the same on any mass (heavier object won’t fall faster)
  • Theorically only reason why you would need the ball to be very heavy, is because you want it “much heavier” than other objects (for interaction purpose)
  • Then, instead of having the ball crazy heavy, try to have the other objects lighter.

There is an equilibrium to be found, a bit like for render params where everything should remain into some bounds : a mesh should not be of size 0.0001 as well as should not be of size 10000.0, etc…

2 Likes