Exemple #1
0
 public void CreateGripPoint(Vector3[] vertices, List <List <int> > grippableList)
 {
     for (int i = 0; i < grippableList.Count; i++) // 次の頂点も同時に参照するため -1
     {
         for (int j = 0; j < grippableList[i].Count - 1; j++)
         {
             Vector3[] worldVert = new Vector3[2] {
                 vertices[grippableList[i][j]], vertices[grippableList[i][j + 1]]
             };
             for (int worldVertI = 0; worldVertI < worldVert.Length; worldVertI++)
             {
                 worldVert[worldVertI] = transform.TransformPoint(worldVert[worldVertI]);
             }
             GrippablePoint2.CreateEdges(worldVert[0], worldVert[1], gameObject.transform);
         }
     }
 }
Exemple #2
0
    void Awake()
    {
        GetComponent <LineRenderer>().GetPositions(edges);

        GrippablePoint2.CreateEdges(edges[0], edges[1]);
        Destroy(gameObject);
        return;

        float radius = 0.1f;

        transform.localScale = new Vector3(radius, radius, radius);


        transform.position   = (edges[0] + edges[1]) / 2;
        transform.localScale = new Vector3((edges[0] - edges[1]).magnitude, radius, radius);  // 仮
        transform.rotation   = Quaternion.FromToRotation(Vector3.right, edges[0] - edges[1]); // 仮
    }