Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope extension, vibration and collision
#16
(28-04-2025, 10:39 AM)0hsyn1 Wrote: As seen in the picture (I shared it before), when I enter the value I obtained into "M" in the ObiRopeAttach script, the red object remains where it is seen, the area I want is the blue area, that is, the point of contact (it can be any place in contact).

If I can get this "M" value right, I want to make a gameObject move from that point to the end of the rope.

Are you using surface collisions by any chance? the code used to get particle indices from a contact is different when using them, as explained in "Retrieving the particle involved in a contact". If you're using surface collisions, the code should look like this:


Code:
// retrieve the offset and size of the simplex in the solver.simplices array:
int simplexStart = solver.simplexCounts.GetSimplexStartAndSize(contact.bodyA, out int simplexSize);

// starting at simplexStart, iterate over all particles in the simplex:
for (int i = 0; i < simplexSize; ++i)
{
    int particleIndex = solver.simplices[simplexStart + i];

    // do something with each particle, for instance get its position:
    var position = solver.positions[particleIndex];
}

instead of just:

Code:
// get the particle index directly, as all simplices are guaranteed to have size 1:
int particleIndex = solver.simplices[contact.bodyA];


(28-04-2025, 10:39 AM)0hsyn1 Wrote: Reset code;
Code:
public void RopeReset()
  {
      rope.ropeBlueprint = blueprint;
      ropeEnd.transform.position = ropeEndStartPos;
  }

This should successfully reset the rope. What are you getting instead?
Reply


Messages In This Thread
RE: Rope extension, vibration and collision - by josemendez - 28-04-2025, 11:15 AM