Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  cloth-rope collision
#3
(21-04-2022, 10:37 AM)josemendez Wrote: Hi there,

Collisions between actors (rope and cloth, for instance) should happen automatically by default, unless you have changed the collision filters in either actor to specify otherwise.

You talk about "detecting the particle collisions", so I take it you're using a script to detect the contacts at runtime? can you share the script you're using?
Code:
private void Awake()
    {
        solver = this.GetComponentInParent<ObiSolver>();
    }

    private void OnEnable()
    {
        solver.OnCollision += Solver_OnCollision;
    }

    private void OnDisable()
    {
        solver.OnCollision -= Solver_OnCollision;
    }

    public void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
    {
        foreach(Oni.Contact contact in e.contacts)
        {
            ObiColliderBase collider = ObiColliderWorld.GetInstance().colliderHandles[contact.bodyB].owner;

            if (collider.CompareTag("Rope") && collider != null)
            {
                int particleIndex = solver.simplices[contact.bodyA];
                if (!(contactParticles.Contains(particleIndex)))
                    AddIndex(particleIndex, e);


                stitcher.AddStitch(particleIndex, solver.simplices[contact.bodyB]);
                stitcher.PushDataToSolver();
            }
This is part of my code. I would like to use the stitcher to attach the two obi actors. I think that something stupid is wrong in this code but I don't know what. Thanks for the help!
Reply


Messages In This Thread
cloth-rope collision - by maygdirf - 21-04-2022, 10:31 AM
RE: cloth-rope collision - by josemendez - 21-04-2022, 10:37 AM
RE: cloth-rope collision - by maygdirf - 21-04-2022, 11:07 AM
RE: cloth-rope collision - by josemendez - 21-04-2022, 11:21 AM
RE: cloth-rope collision - by maygdirf - 21-04-2022, 01:47 PM
RE: cloth-rope collision - by josemendez - 21-04-2022, 02:30 PM
RE: cloth-rope collision - by maygdirf - 21-04-2022, 02:40 PM