10-03-2021, 09:54 PM
Hello.
I have a problem detecting when two softbodies collide. Here's the code I use and the video of the result: https://drive.google.com/file/bla-bla-bla
For some reason when the blue sheep hits the ground it starts sending message that it's colliding with the player, who's still in midair falling few units away. How there's a collision between these two objects if they're apart?
I have a problem detecting when two softbodies collide. Here's the code I use and the video of the result: https://drive.google.com/file/bla-bla-bla
Code:
void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
player_is_grounded = false;
var world = ObiColliderWorld.GetInstance();
foreach (var contact in e.contacts)
{
// this one is an actual collision:
if (contact.distance < 0.01)
{
var pa = solver.particleToActor[contact.bodyA];
var po = solver.particleToActor[contact.bodyB];
if (pa.actor.gameObject != po.actor.gameObject)
{
Debug.Log(pa.actor.gameObject.name + " + " + po.actor.gameObject.name);
}
}
}
}
For some reason when the blue sheep hits the ground it starts sending message that it's colliding with the player, who's still in midair falling few units away. How there's a collision between these two objects if they're apart?