private bool BreakPartsHandler(ref HkBreakOffPoints breakOffPoints, ref HkArrayUInt32 brokenKeysOut) { if (!Sync.IsServer) return true; if (RigidBody == null || Entity.MarkedForClose) return true; ProfilerShort.Begin("BreakPartsHandler"); Debug.Assert(breakOffPoints.Count > 0); bool recollide = false; Vector3D pos = Vector3D.Zero; for (int i = 0; i < breakOffPoints.Count; i++) { var pt = breakOffPoints[i]; if (pt.CollidingBody != null) { var separatingVelocity = Math.Abs(HkUtils.CalculateSeparatingVelocity(RigidBody, pt.CollidingBody, ref pt.ContactPoint)); if (separatingVelocity < 2) continue; if (Vector3D.DistanceSquared(pos, pt.ContactPoint.Position) < 9) continue; pos = pt.ContactPoint.Position; ProfilerShort.CustomValue("BreakAtPoint", 1, 1); recollide |= BreakAtPoint(ref pt, ref brokenKeysOut); } } ProfilerShort.End(); return true; }
private bool BreakPartsHandler(ref HkBreakOffPoints breakOffPoints, ref HkArrayUInt32 brokenKeysOut) { Debug.Assert(breakOffPoints.Count > 0); for (int i = 0; i < breakOffPoints.Count; i++) { var pt = breakOffPoints[i]; BreakAtPoint(ref pt, ref brokenKeysOut); } return true; }
private bool BreakPartsHandler(ref HkBreakOffPoints breakOffPoints, ref HkArrayUInt32 brokenKeysOut) { if (!Sync.IsServer) return true; ProfilerShort.Begin("BreakPartsHandler"); Debug.Assert(breakOffPoints.Count > 0); bool recollide = false; for (int i = 0; i < breakOffPoints.Count; i++) { var pt = breakOffPoints[i]; recollide |= BreakAtPoint(ref pt, ref brokenKeysOut); } ProfilerShort.End(); return true; }