示例#1
0
        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();
        }
示例#2
0
 /// <summary>
 /// Releases unmanaged and - optionally - managed resources.
 /// </summary>
 public override void Dispose()
 {
     LinkedConstraints.Clear();
     MotionState.Dispose();
     base.Dispose();
 }