spring.js 337 B

123456789101112
  1. module.exports = Spring;
  2. /**
  3. * Represents a physical spring. Spring connects two bodies, has rest length
  4. * stiffness coefficient and optional weight
  5. */
  6. function Spring(fromBody, toBody, length, springCoefficient) {
  7. this.from = fromBody;
  8. this.to = toBody;
  9. this.length = length;
  10. this.coefficient = springCoefficient;
  11. }