private void Init() { dbatch = rope.DistanceConstraints.GetFirstBatch(); //ref rope SetNumberParticle(); //set nombre particle initial numberParticleBase = particleInRope; //save nombre particle initial grippedPrepareLessSetup = false; }
private void UpdateTethers() { rope.TetherConstraints.RemoveFromSolver(null); ObiTetherConstraintBatch batch = (ObiTetherConstraintBatch)rope.TetherConstraints.GetFirstBatch(); batch.Clear(); ObiDistanceConstraintBatch dbatch = rope.DistanceConstraints.GetFirstBatch(); for (int i = 0; i < dbatch.ConstraintCount; ++i) { batch.AddConstraint(0, dbatch.springIndices[i * 2 + 1], rope.InterparticleDistance * i, 1, 1); } batch.Cook(); rope.TetherConstraints.AddToSolver(null); }