20-08-2019, 05:22 PM
(This post was last modified: 20-08-2019, 05:24 PM by josemendez.)
(20-08-2019, 04:51 PM)HenryChinaski Wrote: Thanks for the reply.
I tried your suggestions but I am very sorry that I still have problems getting the player collider.
Code:void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
foreach (Oni.Contact contact in e.contacts)
{
// this one is an actual collision:
if (contact.distance < 0.01)
{
Component collider;
if (ObiCollider.idToCollider.TryGetValue(contact.other, out collider))
{
Collider ContactCollider = ObiCollider.idToCollider[contact.other] as Collider;
Debug.Log(ContactCollider.transform.gameObject.name);
}
}
}
}
There is a debug log message whenever the softbody touches the ground, but there is no debug log message when the player touches the softbody.
The player has a capsule collider, a rigidbody, an obi collider and an obi rigidbody.
Make sure the player collider's phase is different than that of the softbody particles. Other than that, there's no reason for it to work with one collider but not with the other. I'd need to take a deep look at your setup to figure out the problem.
Also, this line is redundant:
Code:
Collider ContactCollider = ObiCollider.idToCollider[contact.other] as Collider;
You're already retrieving the collider in
Code:
ObiCollider.idToCollider.TryGetValue(contact.other, out collider)
So why accessing the map two times per contact? double performance hit for no reason. Just get rid of the second lookup.