diff --git a/src/Jitter2/World.Step.cs b/src/Jitter2/World.Step.cs index 5a448b5f..e4d64323 100644 --- a/src/Jitter2/World.Step.cs +++ b/src/Jitter2/World.Step.cs @@ -327,8 +327,6 @@ private unsafe void IterateSmallConstraintsCallback(Parallel.Batch batch) ref RigidBodyData b1 = ref constraint.Body1.Data; ref RigidBodyData b2 = ref constraint.Body2.Data; - AssertConstraint(ref b1, ref b2); - if (constraint.Iterate == null) continue; LockTwoBody(ref b1, ref b2); @@ -371,8 +369,6 @@ private unsafe void IterateConstraintsCallback(Parallel.Batch batch) ref RigidBodyData b1 = ref constraint.Body1.Data; ref RigidBodyData b2 = ref constraint.Body2.Data; - AssertConstraint(ref b1, ref b2); - if (constraint.Iterate == null) continue; LockTwoBody(ref b1, ref b2); @@ -391,8 +387,6 @@ private void IterateContactsCallback(Parallel.Batch batch) ref RigidBodyData b1 = ref c.Body1.Data; ref RigidBodyData b2 = ref c.Body2.Data; - AssertConstraint(ref b1, ref b2); - LockTwoBody(ref b1, ref b2); c.Iterate(); UnlockTwoBody(ref b1, ref b2); @@ -418,23 +412,6 @@ private void DetectCollisionsCallback(Parallel.Batch batch) } } - private void AssertConstraint(ref RigidBodyData rb1, ref RigidBodyData rb2) - { - Debug.Assert(!(rb1.IsStaticOrInactive && rb2.IsStaticOrInactive)); - - if (rb1.IsStatic) - { - Debug.Assert(rb1.InverseMass == 0.0f); - Debug.Assert(rb1.InverseInertiaWorld.Equals(JMatrix.Zero)); - } - - if (rb2.IsStatic) - { - Debug.Assert(rb2.InverseMass == 0.0f); - Debug.Assert(rb2.InverseInertiaWorld.Equals(JMatrix.Zero)); - } - } - private void AssertNullBody() { ref RigidBodyData rigidBody = ref NullBody.Data; @@ -458,6 +435,17 @@ private void ForeachActiveShape(bool multiThread) private void ForeachActiveBody(bool multiThread) { +#if DEBUG + foreach (var body in bodies) + { + if (body.IsStatic) + { + System.Diagnostics.Debug.Assert(MathHelper.UnsafeIsZero(body.Data.InverseInertiaWorld)); + System.Diagnostics.Debug.Assert(body.Data.InverseMass == 0.0f); + } + } +#endif + if (multiThread) { bodies.ParallelForBatch(256, updateBodies);