Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Copy position from one rope to another
#1
Hello,

I have two ropes 0 and 1. The rope 0 is physically managed by the obi solver, and I would like the rope 1 to be only a copy of the rendering of the first one.

To do this, I tried to get all the positions of the rope 0 and I applied them to the rope 1 (see code below).

Code:
public void LateUpdate()
{     
     for (int i = 0; i < _obiRope0.solverIndices.Length; i++)
     {
          var indexParticles = _obiRope0.solverIndices.SolverIndices[i];
                   
                   
          if (_obiRope0.IsParticleActive(indexParticles) == false)
              continue;

          _obiSolver0.positions[indexParticles] = _obiSolver1.positions[indexParticles];
    }
}


However, there are two problems with this solution:
- In the rendering there is a regular teleportation of the rope 1 to its "physical position".
- In terms of performance, physical calculations are still done for the rope 1.


How should the obi solver for the rope 1 be set up to solve the two points above ? Or is there another way to achieve this goal ?

Thanks,
Reply


Messages In This Thread
Copy position from one rope to another - by lufydad - 13-01-2022, 10:33 AM