private void Initialize()
        {
            // Allocate all lists:
            if (implementations == null)
            {
                implementations = new List <IColliderWorldImpl>();
            }

            if (colliderHandles == null)
            {
                colliderHandles = new List <ObiColliderHandle>();
            }
            if (colliderShapes == null)
            {
                colliderShapes = new ObiNativeColliderShapeList();
            }
            if (colliderAabbs == null)
            {
                colliderAabbs = new ObiNativeAabbList();
            }
            if (colliderTransforms == null)
            {
                colliderTransforms = new ObiNativeAffineTransformList();
            }

            if (materialHandles == null)
            {
                materialHandles = new List <ObiCollisionMaterialHandle>();
            }
            if (collisionMaterials == null)
            {
                collisionMaterials = new ObiNativeCollisionMaterialList();
            }

            if (rigidbodyHandles == null)
            {
                rigidbodyHandles = new List <ObiRigidbodyHandle>();
            }
            if (rigidbodies == null)
            {
                rigidbodies = new ObiNativeRigidbodyList();
            }

            if (triangleMeshContainer == null)
            {
                triangleMeshContainer = new ObiTriangleMeshContainer();
            }
            if (edgeMeshContainer == null)
            {
                edgeMeshContainer = new ObiEdgeMeshContainer();
            }
            if (distanceFieldContainer == null)
            {
                distanceFieldContainer = new ObiDistanceFieldContainer();
            }
            if (heightFieldContainer == null)
            {
                heightFieldContainer = new ObiHeightFieldContainer();
            }
        }
Esempio n. 2
0
        public void SetColliders(ObiNativeColliderShapeList shapes, ObiNativeAabbList bounds, ObiNativeAffineTransformList transforms, int count)
        {
            colliderCount = count;

            // insert new empty cellspans at the end if needed:
            while (colliderCount > cellSpans.count)
                cellSpans.Add(new CellSpan(new VInt4(10000), new VInt4(10000)));
        }
        public void GetCells(ObiNativeAabbList cells)
        {
            if (cells.count == grid.usedCells.Length)
            {
                for (int i = 0; i < grid.usedCells.Length; ++i)
                {
                    var   cell = grid.usedCells[i];
                    float size = NativeMultilevelGrid <int> .CellSizeOfLevel(cell.Coords.w);

                    float4 min = (float4)cell.Coords * size;
                    min[3] = 0;

                    cells[i] = new Aabb(min, min + new float4(size, size, size, 0));
                }
            }
        }
Esempio n. 4
0
 public void GetParticleGrid(ObiNativeAabbList cells)
 {
     particleGrid.GetCells(cells);
 }
 public void SetColliders(ObiNativeColliderShapeList shapes, ObiNativeAabbList bounds, ObiNativeAffineTransformList transforms, int count)
 {
     Oni.SetColliders(shapes.GetIntPtr(), bounds.GetIntPtr(), transforms.GetIntPtr(), count);
 }
Esempio n. 6
0
 public void GetParticleGrid(ObiNativeAabbList cells)
 {
 }
Esempio n. 7
0
 public void GetParticleGrid(ObiNativeAabbList cells)
 {
     //Oni.GetParticleGrid(oniSolver, cells.GetIntPtr());
 }
Esempio n. 8
0
 void OnEnable()
 {
     solver = GetComponent <ObiSolver>();
     cells  = new ObiNativeAabbList();
 }