protected override void OnDetach() { MotionState.Dispose(); MotionState.Clear(); if (NativeCollisionObject == null) { return; } //Remove constraints safely var toremove = new FastList <Constraint>(); foreach (var c in LinkedConstraints) { toremove.Add(c); } foreach (var disposable in toremove) { disposable.Dispose(); } LinkedConstraints.Clear(); //~Remove constraints Simulation.RemoveRigidBody(this); base.OnDetach(); }
/// <summary> /// Releases unmanaged and - optionally - managed resources. /// </summary> public override void Dispose() { LinkedConstraints.Clear(); MotionState.Dispose(); base.Dispose(); }