public ActionInterfaceWrapper(IAction actionInterface, DynamicsWorld world) { _actionInterface = actionInterface; _world = world; _debugDraw = new DebugDrawUnmanagedDelegate(DebugDrawUnmanaged); _updateAction = new UpdateActionUnmanagedDelegate(UpdateActionUnmanaged); _native = btActionInterfaceWrapper_new( Marshal.GetFunctionPointerForDelegate(_debugDraw), Marshal.GetFunctionPointerForDelegate(_updateAction)); }
public ActionInterfaceWrapper(IAction actionInterface, DynamicsWorld world) { _actionInterface = actionInterface; _world = world; _debugDraw = new DebugDrawUnmanagedDelegate(DebugDrawUnmanaged); _updateAction = new UpdateActionUnmanagedDelegate(UpdateActionUnmanaged); GCHandle handle = GCHandle.Alloc(this, GCHandleType.Normal); //UnityEngine.Debug.Log("Created " + GCHandle.ToIntPtr(handle).ToInt64()); _native = btActionInterfaceWrapper_new( Marshal.GetFunctionPointerForDelegate(_debugDraw), Marshal.GetFunctionPointerForDelegate(_updateAction), GCHandle.ToIntPtr(handle)); //UnityEngine.Debug.Log("Intptr" + bgActionInterface_getManagedWrapperPntr(_native)); }