Beispiel #1
0
        IEnumerator Start()
        {
            yield return(new WaitUntil(() => world.Ready()));

            var meshFilter = GetComponent <MeshFilter>();
            var mesh       = meshFilter.sharedMesh;


            Vector3[] vertices     = mesh.vertices;
            int       vertex_count = mesh.vertices.Length;

            int[] triangles      = mesh.triangles;
            int   triangle_count = mesh.triangles.Length / 3;

            Stopwatch sw = new Stopwatch();

            sw.Start();
            nativePartixSoftShell = world.CreateSoftShell(
                this,
                vertex_count, vertices,
                triangle_count, triangles,
                32768, transform.position, transform.lossyScale.x, 1.0f);
            sw.Stop();
            UnityEngine.Debug.Log(sw.ElapsedMilliseconds + "ms");
        }
Beispiel #2
0
        IEnumerator Start()
        {
            yield return(new WaitUntil(() => world.Ready()));

            volume.DumpStats(gameObject.name);
            if (vehicle)
            {
                nativePartixSoftVolume = world.CreateVehicle2(
                    this,
                    volume.vertices.Length,
                    volume.vertices,
                    volume.tetrahedra.Length,
                    volume.tetrahedra,
                    volume.faces.Length,
                    volume.faces,
                    controlTransform.position,
                    partixScale,
                    pointMass);
            }
            else
            {
                nativePartixSoftVolume = world.CreateSoftVolume2(
                    this,
                    volume.vertices.Length,
                    volume.vertices,
                    volume.tetrahedra.Length,
                    volume.tetrahedra,
                    volume.faces.Length,
                    volume.faces,
                    controlTransform.position,
                    partixScale,
                    pointMass);
            }
        }
Beispiel #3
0
        IEnumerator Start()
        {
            yield return(new WaitUntil(() => world.Ready()));

            var mesh = BuildTriangleMesh();

            Vector3[] vertices     = mesh.vertices;
            int       vertex_count = mesh.vertices.Length;

            int[] triangles      = mesh.triangles;
            int   triangle_count = mesh.triangles.Length / 3;

            UnityEngine.Debug.Log(vertices.Length);
            UnityEngine.Debug.Log(vertex_count);
            UnityEngine.Debug.Log(triangles.Length);
            UnityEngine.Debug.Log(triangle_count);

            Stopwatch sw = new Stopwatch();

            sw.Start();
            nativePartixSoftShell = world.CreateSoftShell(
                this,
                vertex_count, vertices,
                triangle_count, triangles,
                128, transform.position, transform.lossyScale.x, 1.0f);
            if (duplicateOffset != Vector3.zero)
            {
                nativeDup = world.CreateSoftShell(
                    this,
                    vertex_count, vertices,
                    triangle_count, triangles,
                    128, transform.position + duplicateOffset,
                    transform.lossyScale.x, 1.0f);
            }
            sw.Stop();
            UnityEngine.Debug.Log(sw.ElapsedMilliseconds + "ms");
        }
Beispiel #4
0
        IEnumerator Start()
        {
            yield return(new WaitUntil(() => world.Ready()));

            nativePartixPlane = world.CreatePlane(transform.position, transform.up);
        }