Exemple #1
0
    protected override void OnDestroy()
    {
//		Debug.Log("Destroying a Constraint.");
        if (_handle == IntPtr.Zero)
        {
            Debug.LogError("ChipmunkConstraint handle is already null.");
            return;
        }

        if (CP._cpConstraintGetSpace(_handle) != IntPtr.Zero)
        {
            Debug.LogError("Attempted to destroy a ChipmunkConstraint that was still added to a space.");
            return;
        }

        var gch = GCHandle.FromIntPtr(CP._cpConstraintGetUserData(_handle));

        if (gch.Target != this)
        {
            Debug.Log("ChipmunkConstaint handle does not match");
        }
        gch.Free();
    }