(09-09-2020, 09:34 AM)josemendez Wrote: Hi!I managed to solve this problem, seems that it was really important that objects scale should be (1;1;1).
I think you're mixing up different spaces. Control points are expressed in the rope's local space, just like vertices in a mesh. So if you've rotated the rope transform, adding 1 to targetPos.y might shift the rope in world-space x or z axis.
The pin constraint's "offset" is the position that the particle will be pinned to, expressed in the collider's local space. Passing zero will pin the particle inside the collider, at its center. Note that this can result in constraint fighting, if collisions with that collider are enabled. See the last bit of:
http://obi.virtualmethodstudio.com/tutor...aints.html
If you're unfamiliar with vector spaces, it's 3D math 101. Let me know if you need more info/resources about this.
Now I have another issue, could you elaborate what's going on with Solvers collision argument contacts? I.e. If I have multiple ropes inside scene contact[i].particle never matches ropes element particle (on one rope it does match, on another it doesn't). When cutting first rope (with 18 elements) everything is as expected. But once trying to cut second rope I get particle number from contact to be 130-150, and that number makes not a lot of sense to me.
Code:
private void Solver_OnCollision(ObiSolver solver, ObiSolver.ObiCollisionEventArgs args)
{
for (int i = 0; i < args.contacts.Count; ++i)
{
if (args.contacts.Data[i].distance < 0)
{
ObiColliderBase collider = ObiColliderWorld.GetInstance().colliderHandles[args.contacts[i].other].owner;
if (collider)
{
if (collider.CompareTag("Cutter"))
{
if (selectedRope)
{
Debug.LogError($"particle { args.contacts[i].particle}");
selectedRope.Tear(selectedRope.elements[args.contacts[i].particle]);
selectedRope.RebuildConstraintsFromElements();
selectedRope = null;
}
}
}
}
}
}