class Craft{ constructor(opt={}){ this.fix=opt.fix||[] this.edges=opt.edges||[] this.faces=opt.faces||[] this.joints=opt.joints||[] this.complexEdges=[] this.complexFaces=[] this.p_jt=[[],[],[]] this.o_jt=[[],[],[]] this.fc=[] this.weight=0;this.m_center=[0,0,0] this.reactive=false this.reactSetup=opt.reactive||{} this.reactSetup.generateFriction=this.reactSetup.generateFriction||'vmultf(vadd(this.anchor.pr_fromGrid(this.p_fix[psz[i][2]]),vmultf(this.anchor.fromGrid(psz[i][0]),-1)),1)' } addFixture(p,c={},joint=-1){ if(!(this.joints[joint]||joint<0))return -1 let y=p,jt=joint,t=0,x=this.joints.length while(t-1||c>x){ c++ this.joints[i].chain.push(z) z=this.joints[z].joint } } this.m_center=this.weight?vmultf(this.m_center,1/this.weight):[0,0,0] this.weld() this.weld() this.reactive.p_fix=[] x=this.reactive.fix.length for(let i=0;i-1&&c-1&&c-1&&c-1&&c