示例#1
0
    public twoCellInteraction(Cell2 icellA, Cell2 icellB)
    {
        cellA = icellA;
        cellB = icellB;

        // Assigning the closest point on each cell surface to the cells themselves. DONT FORGET TO MOVE IT HERE!
        // Find the closest point between the two cells on each cell's surface, and calculate the radius around which a receptor interaction might happen. LOCAL SPACE!
        Vector3 fromCellAToCellB = cellB.gameObject.transform.position - cellA.gameObject.transform.position;

        //Vector3 closestPointIfSphere = cellA.localToGlobal(cellA.radius * fromCellAToCellB.normalized);// WHY USE THIS?!
        // to find actual closest point on surface, we find the closest vertex to the point on a spherical cell
        //cellA.closestPointToInteractingCellOnCellSurface = cellA.findClosestVertexOnSurface(closestPointIfSphere); // KANAL - no need to find closest point on sphere first, just find the closest point to the other cell.
        cellA.closestPointToInteractingCellOnCellSurface = cellA.findClosestVertexOnSurface(cellB.transform.position);
        // Setting the origin vertex for filopodia
        //cellA.endocytosisCenterVert = cellA.findFarthestVertexIndexOnSurface(cellB.transform.position);

        // cell 2
        Vector3 fromCellBToCellA = cellA.gameObject.transform.position - cellB.gameObject.transform.position;

        //closestPointIfSphere = cellB.localToGlobal(cellB.radius * fromCellBToCellA.normalized);
        // to find actual closest point on surface, we find the closest vertex to the point on a spherical cell
        //cellB.closestPointToInteractingCellOnCellSurface = cellB.findClosestVertexOnSurface(closestPointIfSphere);
        cellB.closestPointToInteractingCellOnCellSurface = cellB.findClosestVertexOnSurface(cellA.transform.position);
        // Setting the origin vertex for filopodia
        //cellB.endocytosisCenterVert = cellB.findFarthestVertexIndexOnSurface(cellA.transform.position);

        // Set values for output

        /*cellA.outputValues.interactionPointOnCell = cellA.closestPointToInteractingCellOnCellSurface;
        *  cellB.outputValues.interactionPointOnCell = cellB.closestPointToInteractingCellOnCellSurface;*/

        // Create a line between the cells

        /*LineRenderer lineObject = GameObject.Instantiate(Resources.Load("LineBetweenReceptors", typeof(LineRenderer))) as LineRenderer;
         * lineObject.gameObject.name = "LineBetweenCells";
         * // Draw the line itself
         * lineObject.SetPosition(0, cellA.closestPointToInteractingCellOnCellSurface);//cellA.transform.position
         * lineObject.SetPosition(1, cellB.closestPointToInteractingCellOnCellSurface); //cellB.transform.position
         * lineObject.SetColors(new Color(0f, 0f, 1f, 0.3f), new Color(0f, 0f, 1f, 0.3f));*/

        Debug.Log("Distance between cells: " + Utils.calcEuclideanDistance(cellA.closestPointToInteractingCellOnCellSurface, cellB.closestPointToInteractingCellOnCellSurface));
    }