26-02-2021, 03:58 PM
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.
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.
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.