public static void CollisonSolve_Mesh(BaseObject b) { if (b.collider == null || b.collider.Type != ColliderType.Mesh) { return; } List <ContactPoint> cps = new List <ContactPoint>(); Vector2 dp = Vector2.Zero; if (ExtensionMethods.MapBoundsIntersection(b.collider.mesh, ref dp)) { b.position += dp; } if (!CollisionMesh(b.collider, ref cps)) { return; } Vector2 d0; Vector2 d1; for (int i = 0; i < cps.Count; i++) { d0 = (b.position - (cps[i].point - cps[i].normal)).Normalized(); d1 = (b.position - cps[i].point).Normalized(); float angle = ExtensionMethods.Angle(d0, d1); b.forward = b.forward.Rotate(angle); b.position += cps[i].normal; } }