public DebugDraw()
        {
            _drawAabb         = new DrawAabbUnmanagedDelegate(DrawAabb);
            _drawArc          = new DrawArcUnmanagedDelegate(DrawArc);
            _drawBox          = new DrawBoxUnmanagedDelegate(DrawBox);
            _drawCapsule      = new DrawCapsuleUnmanagedDelegate(DrawCapsule);
            _drawCone         = new DrawConeUnmanagedDelegate(DrawCone);
            _drawContactPoint = new DrawContactPointUnmanagedDelegate(DrawContactPoint);
            _drawCylinder     = new DrawCylinderUnmanagedDelegate(DrawCylinder);
            _drawLine         = new DrawLineUnmanagedDelegate(DrawLine);
            _drawPlane        = new DrawPlaneUnmanagedDelegate(DrawPlane);
            _drawSphere       = new DrawSphereUnmanagedDelegate(DrawSphere);
            _drawSpherePatch  = new DrawSpherePatchUnmanagedDelegate(DrawSpherePatch);
            _drawTransform    = new DrawTransformUnmanagedDelegate(DrawTransform);
            _drawTriangle     = new DrawTriangleUnmanagedDelegate(DrawTriangle);
            _getDebugMode     = new GetDebugModeUnmanagedDelegate(GetDebugModeUnmanaged);
            _cb = new SimpleCallback(SimpleCallbackUnmanaged);

            IntPtr native = btIDebugDrawWrapper_new(
                GCHandle.ToIntPtr(GCHandle.Alloc(this)),
                Marshal.GetFunctionPointerForDelegate(_drawAabb),
                Marshal.GetFunctionPointerForDelegate(_drawArc),
                Marshal.GetFunctionPointerForDelegate(_drawBox),
                Marshal.GetFunctionPointerForDelegate(_drawCapsule),
                Marshal.GetFunctionPointerForDelegate(_drawCone),
                Marshal.GetFunctionPointerForDelegate(_drawContactPoint),
                Marshal.GetFunctionPointerForDelegate(_drawCylinder),
                Marshal.GetFunctionPointerForDelegate(_drawLine),
                Marshal.GetFunctionPointerForDelegate(_drawPlane),
                Marshal.GetFunctionPointerForDelegate(_drawSphere),
                Marshal.GetFunctionPointerForDelegate(_drawSpherePatch),
                Marshal.GetFunctionPointerForDelegate(_drawTransform),
                Marshal.GetFunctionPointerForDelegate(_drawTriangle),
                Marshal.GetFunctionPointerForDelegate(_getDebugMode),
                Marshal.GetFunctionPointerForDelegate(_cb));

            InitializeUserOwned(native);
        }
        internal void InitTarget(IDebugDraw target)
        {
            _drawAabb = new DrawAabbUnmanagedDelegate(target.DrawAabb);
            _drawArc = new DrawArcUnmanagedDelegate(target.DrawArc);
            _drawBox = new DrawBoxUnmanagedDelegate(target.DrawBox);
            _drawCapsule = new DrawCapsuleUnmanagedDelegate(target.DrawCapsule);
            _drawCone = new DrawConeUnmanagedDelegate(target.DrawCone);
            _drawContactPoint = new DrawContactPointUnmanagedDelegate(target.DrawContactPoint);
            _drawCylinder = new DrawCylinderUnmanagedDelegate(target.DrawCylinder);
            _drawLine = new DrawLineUnmanagedDelegate(target.DrawLine);
            _drawPlane = new DrawPlaneUnmanagedDelegate(target.DrawPlane);
            _drawSphere = new DrawSphereUnmanagedDelegate(target.DrawSphere);
            _drawSpherePatch = new DrawSpherePatchUnmanagedDelegate(target.DrawSpherePatch);
            _drawTransform = new DrawTransformUnmanagedDelegate(target.DrawTransform);
            _drawTriangle = new DrawTriangleUnmanagedDelegate(target.DrawTriangle);
            _getDebugMode = new GetDebugModeUnmanagedDelegate(GetDebugModeUnmanaged);
            _cb = new SimpleCallback(SimpleCallbackUnmanaged);

            _native = btIDebugDrawWrapper_new(
                GCHandle.ToIntPtr(GCHandle.Alloc(this)),
                Marshal.GetFunctionPointerForDelegate(_drawAabb),
                Marshal.GetFunctionPointerForDelegate(_drawArc),
                Marshal.GetFunctionPointerForDelegate(_drawBox),
                Marshal.GetFunctionPointerForDelegate(_drawCapsule),
                Marshal.GetFunctionPointerForDelegate(_drawCone),
                Marshal.GetFunctionPointerForDelegate(_drawContactPoint),
                Marshal.GetFunctionPointerForDelegate(_drawCylinder),
                Marshal.GetFunctionPointerForDelegate(_drawLine),
                Marshal.GetFunctionPointerForDelegate(_drawPlane),
                Marshal.GetFunctionPointerForDelegate(_drawSphere),
                Marshal.GetFunctionPointerForDelegate(_drawSpherePatch),
                Marshal.GetFunctionPointerForDelegate(_drawTransform),
                Marshal.GetFunctionPointerForDelegate(_drawTriangle),
                Marshal.GetFunctionPointerForDelegate(_getDebugMode),
                Marshal.GetFunctionPointerForDelegate(_cb));
        }