Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Collision works buggy
#1
Hi,
I have some problems with collisions. I am using the code below for each collision to get the touching each other rope but it gives wrong/inconsistent data.
Here each rope touching each other should be having darker tone. I tried different settings and it did not change. Ropes are in the same z-axis and they definitely touch as I checked from different angles. Surface collision is open, all works as expected, I am using the latest 6.0.1 version.
Here is a video : Video
Do anyone having the same issue who can help me?  Ángel
Thanks!

Code:
using UnityEngine;
using Obi;

public class RopeCollision : MonoBehaviour
{

    ObiSolver solver;

    void Start()
    {
        solver = GetComponent<ObiSolver>();
        solver.OnParticleCollision += Solver_OnCollision;
    }

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

    void Solver_OnCollision(object sender, ObiSolver.ObiCollisionEventArgs e)
    {
        var world = ObiColliderWorld.GetInstance();

        foreach (Oni.Contact contact in e.contacts)
        {
            var pa = solver.particleToActor[contact.bodyA];
            var po = solver.particleToActor[contact.bodyB];
            if (pa == null || po == null)
                return;
            if (pa.actor.gameObject.name != po.actor.gameObject.name)
            {
                //print(pa.actor.gameObject+" , "+ po.actor.gameObject);
                GameManager.Instance.Colliding(pa.actor.gameObject, po.actor.gameObject);
            }
        }
       
    }

}
Reply


Messages In This Thread
Collision works buggy - by boulder - 11-05-2021, 01:33 AM
RE: Collision works buggy - by josemendez - 11-05-2021, 07:36 AM
RE: Collision works buggy - by boulder - 11-05-2021, 04:20 PM
RE: Collision works buggy - by josemendez - 12-05-2021, 08:52 AM