コード例 #1
0
 protected virtual void OnDestroy()
 {
     if (_constraint != null)
     {
         BulletPhysicsWorldManager.Unregister(_constraint);
         Dispose();
     }
 }
コード例 #2
0
        //Unity OnDisable
        protected override void OnDisable()
        {
            //Check if registered
            //TODO: See OnEnable()
            if (!Registered || !Initialized)
            {
                return;
            }

            //Unregister from the physics world
            if (!Initialized)
            {
                return;
            }
            BulletPhysicsWorldManager.Unregister(BodyInstance);
            Registered = false;
        }
コード例 #3
0
        /// <summary>
        /// Disposes of the RigidBody
        /// Should only be called internally or from a physics world instance.
        /// </summary>
        public override void Dispose()
        {
            //Dispose of all the components in reverse order
            if (Disposing)
            {
                return;
            }
            if (Registered)
            {
                BulletPhysicsWorldManager.Unregister(_staticBody);
            }

            Disposing = true;
            _staticBody?.Dispose();
            _constructionInfo?.Dispose();
            PhysicsCollisionShape?.Dispose();
        }