Ejemplo n.º 1
0
 internal static extern IntPtr ExportAndReturnNextContact(
     IntPtr contactHandle,
     ref PContactExport3D export,
     ref PConvexCacheExport3D convexExport,
     ref PManifoldExport3D manifoldExport3D1,
     ref PManifoldExport3D manifoldExport3D2,
     ref PManifoldExport3D manifoldExport3D3);
Ejemplo n.º 2
0
        public static void PrepareContacts()
        {
            for (int i = 0; i < _contactCount; i++)
            {
                PContactExport3D export = contactExports[i];

                //some
                if (export.id == 0)
                {
                    continue;
                }

                PContact3D c;

                if (contactDictionary.ContainsKey(export.id))
                {
                    c = contactDictionary[export.id];
                }
                else
                {
                    c = new PContact3D(export.id);
                    contactDictionary[export.id] = c;
                }

                c.Update(
                    contactPtrs[i],
                    export.manifoldCount,
                    export.relativeVelocity,
                    export.isTrigger
                    );

                AddAllContactWrapper(c);
            }
        }
Ejemplo n.º 3
0
        public static void AddExternalConvexCache(PInternalState3D state)
        {
            for (int i = 0; i < state.contactCount; i++)
            {
                PContactExport3D     export       = state.contactExports[i];
                PConvexCacheExport3D convexExport = state.convexExports[i];

                NativeParallel3D.AddExternalConvexCacheData(export.id, convexExport);
            }
        }
Ejemplo n.º 4
0
        public static void AddExternalContactWarmStartData(PInternalState3D state)
        {
            for (int i = 0; i < state.contactCount; i++)
            {
                PContactExport3D export = state.contactExports[i];
                int manifoldIndex       = 3 * i;
                PManifoldExport3D m1    = state.manifoldExports[manifoldIndex];
                PManifoldExport3D m2    = state.manifoldExports[manifoldIndex + 1];
                PManifoldExport3D m3    = state.manifoldExports[manifoldIndex + 2];

                NativeParallel3D.AddExternalContactWarmStartData(export.id, export.flag, (byte)export.manifoldCount, m1, m2, m3);
            }
        }
Ejemplo n.º 5
0
        public static void ExportContacts()
        {
            if (!initialized)
            {
                Initialize();
            }

            _contactCount = 0;
            int index = 0;

            IntPtr contactPtr = NativeParallel3D.GetContactList(internalWorld.IntPointer);

            while (contactPtr != IntPtr.Zero)
            {
                contactPtrs[index] = contactPtr;
                PContactExport3D     export       = contactExports[index];
                PConvexCacheExport3D convexExport = convexExports[index];
                int manifoldIndex    = 3 * index;
                PManifoldExport3D m1 = manifoldExports[manifoldIndex];
                PManifoldExport3D m2 = manifoldExports[manifoldIndex + 1];
                PManifoldExport3D m3 = manifoldExports[manifoldIndex + 2];

                contactPtr            = NativeParallel3D.ExportAndReturnNextContact(contactPtr, ref export, ref convexExport, ref m1, ref m2, ref m3);
                contactExports[index] = export;
                convexExports[index]  = convexExport;

                int manifoldCount = export.manifoldCount;

                if (manifoldCount == 1)
                {
                    manifoldExports[manifoldIndex] = m1;
                }
                else if (manifoldCount == 2)
                {
                    manifoldExports[manifoldIndex]     = m1;
                    manifoldExports[manifoldIndex + 1] = m2;
                }
                else if (manifoldCount == 3)
                {
                    manifoldExports[manifoldIndex]     = m1;
                    manifoldExports[manifoldIndex + 1] = m2;
                    manifoldExports[manifoldIndex + 2] = m3;
                }

                index++;
            }

            _contactCount = index;
        }