Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  ObiRope Collided Object Info Retrieving
#1
Triste 
Hi there, 
I want to make a 2d game where you spawn balls to land on ropes. After a ball collides with rope it will self destruct. So I need help with getting the info of the collided object. I looked at the main page and a few forums, tried to do a few things but ended up with spahetti code and confusion. Can please someone help me?

    public ObiSolver solver;
    Obi.ObiSolver.ObiCollisionEventArgs frame;
    Obi.ObiList<Oni.Contact> _contacts = new Obi.ObiList<Oni.Contact>();
    void OnEnable()
    {
        solver.OnParticleCollision += Solver_OnCollision;
    }

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

     void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
    {
        _contacts = e.contacts;
        if (_contacts != null) Debug.Log("Collision!");
    }


I used this to see if there is any collisions before the ball hits, and there is on every update??? After the ball hits and stays on the rope nothing changes. I get this code block from another forum. The problem is nobody so far wanted to get the collider or gameobject info who's collided to rope so far. That's where I am stuck.

What I want is something like here:

     private void OnCollisionEnter(Collision collision)
    {
        Destroy(collision.gameObject);
    }

Please help.
Reply


Messages In This Thread
ObiRope Collided Object Info Retrieving - by Ropuska - 15-10-2022, 03:43 PM