Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem detecting collisions between two softbodies
#1
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

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?
Reply


Messages In This Thread
Problem detecting collisions between two softbodies - by the-lander - 10-03-2021, 09:54 PM