add rope support

This commit is contained in:
Asraelite 2016-03-26 18:43:34 +00:00
parent ccc77490ea
commit ff0ac094cf
7 changed files with 91 additions and 19 deletions

View file

@ -1,9 +1,11 @@
'use strict';
class Copula {
constructor(b1, b2) {
this.b1 = b1;
this.b2 = b2;
constructor(b1, b2, p1, p2) {
this.bodyA = b1;
this.bodyB = b2;
this.pointA = p1 || b1.com;
this.pointB = p2 || b2.com;
}
}

View file

@ -3,8 +3,19 @@
const Copula = require('./copula.js');
class Rope extends Copula {
constructor(p1, p2) {
super();
constructor(b1, b2) {
super(b1, b2);
this.type = 'rope';
this._length = 0;
}
get length() {
return this._length;
}
set length(len) {
this.length = len;
this.b2joint.SetLength(len);
}
}