public zConstraint(zUnit unit1, zUnit unit2, bool ishide) { this.unit1 = unit1; this.unit2 = unit2; length = SPACING * unit1.getDistanceTo(unit2); tearDist = length * TEARDIST; isHide = ishide; minlength = length * SPRINGSTOP; unit1.connectedTo.Add(unit2, this); unit2.connectedTo.Add(unit1, this); }
internal float getDistanceTo(zUnit unit2) { return((pos - unit2.pos).magnitude); }