public ContactPoint[] IsColliding(Transform at, Transform bt, IShape other) { List <ContactPoint> cps = new List <ContactPoint>(); foreach (var sh in shapes) { Transform a = at; a.position += Vector3.Transform(sh.Localposition, at.rotation); BoundSphere sb = sh.ToBoundSphere(); Transform thisT = at; thisT.position += Vector3.Transform(sb.CompoundOffset, at.rotation); if (sb.IsColliding(thisT, bt, other.ToBoundSphere()).Length > 0) { cps.AddRange(sh.IsColliding(a, bt, other)); } } for (int i = 0; i < cps.Count; i++) { ContactPoint cp = cps[i]; if (cp.bodyA == this) { cp.bodyA = root; } if (cp.bodyB == this) { cp.bodyB = root; } cps[i] = cp; } return(cps.ToArray()); }