Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Segregation of instructions to each rope at the time of collision
#3
Thank you for your reply.

When I tried to call the function to change the color of each rope from the script assigned to Solver, I wrote the following code and got an error.

Code:
private void Solver_OnCollision(ObiSolver solver, ObiSolver.ObiCollisionEventArgs e)
    {
        foreach (Oni.Contact contact in e.contacts)
        {
            if (contact.distance < 0.025f)
            {
          var collidedActor = solver.particleToActor[contact.bodyA];
              if (collidedActor != null)
              {
            RopeController ropecon = collidedActor.GetComponent<RopeController>();
                ropecon.ChangeColorDark();
              }
            }
        }
    }

I think GetComponent works with Obi Collider, but doesn't it work with Obi Rope?
And is there an alternative?

I'm sorry for the beginner-smelling question, but thank you.
Reply


Messages In This Thread
RE: Segregation of instructions to each rope at the time of collision - by NakanHogeri - 26-02-2021, 03:58 PM