コード例 #1
0
ファイル: PolyMeshEditor.cs プロジェクト: kwyoung11/RailBall
 static void CreateSquare(PolyMesh polyMesh, float size)
 {
     polyMesh.keyPoints.AddRange(new Vector3[] { new Vector3(size, size), new Vector3(size, -size), new Vector3(-size, -size), new Vector3(-size, size) });
     polyMesh.curvePoints.AddRange(new Vector3[] { Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero });
     polyMesh.isCurve.AddRange(new bool[] { false, false, false, false });
     polyMesh.BuildMesh();
 }
コード例 #2
0
        private static void PostProcess(GameObject go)
        {
            PolyMesh polymesh = go.GetComponent <PolyMesh>();

            if (polymesh != null)
            {
                polymesh.BuildMesh();
            }
        }
コード例 #3
0
    void MakeGround(List <Vector2> corners)
    {
        groundMesh.keyPoints.Clear();
        groundMesh.isCurve.Clear();
        Vector2[] pts = new Vector2[corners.Count];
        int       i   = 0;

        foreach (Vector2 point in corners)
        {
            groundMesh.keyPoints.Add(point);
            groundMesh.isCurve.Add(false);
            DebugPool.GetChild(i).position = point.XYZ(-5);
            pts[i] = point;
            i++;
        }
        groundMesh.BuildMesh();
        groundCollider.points = pts;
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        ballRB         = ball.GetComponent <Rigidbody2D>();
        positions      = new List <Vector2>();
        groundMesh     = ground.GetComponent <PolyMesh>();
        groundCollider = ground.GetComponent <PolygonCollider2D>();
        groundMesh.keyPoints.Clear();

        Vector2[] pts = new Vector2[testPoints.Length];
        int       i   = 0;

        foreach (Transform point in testPoints)
        {
            groundMesh.keyPoints.Add(point.position);
            pts[i] = (Vector2)point.position;
            i++;
        }
        groundMesh.BuildMesh();
        groundCollider.points = pts;
    }
コード例 #5
0
	static void CreateSquare(PolyMesh polyMesh, float size)
	{
		polyMesh.keyPoints.AddRange(new Vector3[] { new Vector3(size, size), new Vector3(size, -size), new Vector3(-size, -size), new Vector3(-size, size)} );
		polyMesh.curvePoints.AddRange(new Vector3[] { Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero } );
		polyMesh.isCurve.AddRange(new bool[] { false, false, false, false } );
		polyMesh.BuildMesh();
	}