Example #1
0
    void Update()
    {
        if (Input.GetMouseButtonUp(0) || Input.GetKeyDown(KeyCode.Space))
        {
            //ClearClearedCoordinates();
            //SortCoordinates();

            //foreach (Vector3 pos in superCleanedCoordinates) {
            //    Instantiate(prefab, new Vector3(pos.x, 0.2f, pos.z), Quaternion.identity);
            //}

            List <Vector3> points = ClearCoordinates.Points(ReadJSON.pointsV3(jsonFileName), radius);

            firstObject  = Instantiate(prefab, points[0], Quaternion.identity);
            secondObject = Instantiate(prefab, points[1], Quaternion.LookRotation(points[1] - points[0], Vector3.up));

            for (byte i = 2; i < points.Count; i++)
            {
                Instantiate(prefab, points[i], Quaternion.LookRotation(points[i] - points[i - 1], Vector3.up));
                //transform.LookAt(superCleanedCoordinates[i - 1]
            }

            firstObject.transform.LookAt(secondObject.transform);

            Debug.Log("Points built: " + points.Count);
        }
    }
Example #2
0
    void Start()
    {
        List <Vector3> points = ClearCoordinates.Points(ReadJSON.pointsV3(jsonFileName), radius);

        firstObject  = Instantiate(prefab, points[0], Quaternion.identity);
        secondObject = Instantiate(prefab, points[1], Quaternion.LookRotation(points[1] - points[0], Vector3.up));

        for (int i = 2; i < points.Count; i++)
        {
            Instantiate(prefab, points[i], Quaternion.LookRotation(points[i] - points[i - 1], Vector3.up));
            //transform.LookAt(superCleanedCoordinates[i - 1]
        }

        firstObject.transform.LookAt(secondObject.transform);
    }