26-02-2021, 12:51 PM
(This post was last modified: 26-02-2021, 01:03 PM by NakanHogeri.
Edit Reason: Remove ambiguity
)
I'm currently trying to change the color of two Obi Rope in the same Solver at their own timing when they collide with other objects.
I pasted the script below on each rope and tried it, and when one rope collided with another object, the color of the other rope was the same.
Obi version 6.0, Surface-based collisions are enabled on each rope.
If I had two Obi Solvers in the scene and one rope as a child object of one Solver, the current script would work, but it would be very costly.
I would be very grateful if you could let me know if you have an elegant solution.
Thanks.
I pasted the script below on each rope and tried it, and when one rope collided with another object, the color of the other rope was the same.
Code:
private void Solver_OnCollision(ObiSolver solver, ObiSolver.ObiCollisionEventArgs e)
{
foreach (Oni.Contact contact in e.contacts)
{
if (contact.distance < 0.025f)
{
ChangeColorDark();
}
}
}
Obi version 6.0, Surface-based collisions are enabled on each rope.
If I had two Obi Solvers in the scene and one rope as a child object of one Solver, the current script would work, but it would be very costly.
I would be very grateful if you could let me know if you have an elegant solution.
Thanks.