コード例 #1
0
ファイル: MeshRenderer5D.cs プロジェクト: leoli1/Mesh5D
	public void CreateMesh(){
		if (mesh5D == null)
			return;

		if (transform5D == null) {
			transform5D = GetComponent<Transform5D> ();
			if (transform5D == null)
				return;
		}
		foreach (Transform trans in transform.GetComponentsInChildren<Transform>()) {
			if (trans != transform && trans != null)
				DestroyImmediate (trans.gameObject);
		}
		mesh4D = Transform4D.CreateEmpty ();
		mesh4D.transform.SetParent (transform);

		MeshRenderer4D renderer = mesh4D.GetComponent<MeshRenderer4D> ();

		Vector4[] projectedVertices = getProjectedVertices ();
		renderer.mesh4D.vertices = projectedVertices;
		renderer.mesh4D.edges = mesh5D.edges;

		renderer.CreateMesh ();
		meshCreated = true;
	}
コード例 #2
0
ファイル: MeshRenderer4D.cs プロジェクト: leoli1/Mesh5D
    public void CreateMesh()
    {
        if (mesh4D == null)
        {
            return;
        }
        if (vertexObject == null)
        {
            vertexObject = Camera4D.mainCamera.standardVertexGameObject;
        }
        if (edgeObject == null)
        {
            edgeObject = Camera4D.mainCamera.standardEdgeGameObject;
        }

        if (transform4D == null)
        {
            transform4D = GetComponent <Transform4D> ();
            if (transform4D == null)
            {
                return;
            }
        }
        foreach (Transform trans in transform.GetComponentsInChildren <Transform>())
        {
            if (trans != transform)
            {
                DestroyImmediate(trans.gameObject);
            }
        }

        vertexObjects = new List <GameObject> ();
        edgeObjects   = new List <GameObject> ();

        Vector3[] projectedVertices = getProjectedVertices();
        foreach (Vector3 vertex in projectedVertices)
        {
            GameObject v = GameObject.Instantiate(vertexObject, transform);
            v.transform.localPosition = vertex;
            vertexObjects.Add(v);
        }

        for (int i = 0; i < mesh4D.edges.Length; i += 2)
        {
            GameObject   edge = GameObject.Instantiate(edgeObject, transform);
            LineRenderer lr   = edge.GetComponent <LineRenderer> ();
            lr.startColor = Color.blue;
            lr.endColor   = Color.blue;
            lr.SetPositions(new Vector3[] {
                projectedVertices [mesh4D.edges [i]],
                projectedVertices [mesh4D.edges [i + 1]],
            });
            edgeObjects.Add(edge);
        }
        meshCreated = true;
    }
コード例 #3
0
ファイル: RotationAnimation.cs プロジェクト: leoli1/Mesh5D
 public void StartAnimation()
 {
     if (targetObject == null)
     {
         targetObject = GetComponent <Transform4D> ();
         if (targetObject == null)
         {
             return;
         }
     }
     StartCoroutine("Animate");
     isAnimating = true;
 }
コード例 #4
0
ファイル: MeshRenderer4D.cs プロジェクト: leoli1/Mesh5D
 void Enable()
 {
     transform4D = GetComponent <Transform4D> ();
     CreateMesh();
 }
コード例 #5
0
 // Start is called before the first frame update
 void Start()
 {
     transform4D = GetComponent <Transform4D>();
 }