GetShapePath() public méthode

public GetShapePath ( Vector3 path = null, Quaternion rots = null ) : ShapePath,
path Vector3
rots Quaternion
Résultat ShapePath,
    // Update is called once per frame
    void OnDrawGizmos()
    {
        if (points == null || points.Count < 1)
        {
            return;
        }

        // ShapePath
        pointList = new PointList();

        // ShapePath
        if (pointList != null)
        {
            shapePath = pointList.GetShapePath(points.ToArray(), rots.ToArray());

            for (int i = 0; i < num; i++)
            {
                float v = (float)i / num;

                Vector3 pt;
//				pt = shapePath.getPointInfoVec3Percent(v);
                PathVector pv = shapePath.getPathInfo(v);
                pt = new Vector3(pv.x, pv.y, pv.z);

                Gizmos.color = color;
                Gizmos.DrawWireSphere(pt, 0.25f);

                Quaternion rot = pv.rot;

                //
                Gizmos.color = new Color(0, 0, 0, 0.25f);
                Gizmos.DrawRay(pt, rot * Vector3.up * 2);
                Gizmos.DrawRay(pt, rot * Vector3.right * 2);

                Quaternion q2 = GetQuaternionAt(v);
                Gizmos.color = Color.green;
                Gizmos.DrawRay(pt, q2 * Vector3.up);
                Gizmos.color = Color.red;
                Gizmos.DrawRay(pt, q2 * Vector3.right);
            }
        }
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        randomPoints = new List <Vector3>();
        for (int i = 0; i < 5; i++)
        {
            randomPoints.Add(new Vector3((i) * 10, Random.Range(-50.0f, 50.0f), Random.Range(-50.0f, 50.0f)));
            //randomPoints.Add(new Vector3(Random.Range(- 50.0f, 50.0f), Random.Range(- 50.0f, 50.0f), Random.Range(- 50.0f, 50.0f)) * 0.4f);
        }


        // BezierCurve3
        curve = new THREE.CurvePath();

//		Vector3 c = (randomPoints[1] - randomPoints[2]) * -1 + randomPoints[2];
//		for (int i = 2; i < randomPoints.Count-1; i++) {
//			c = (c - randomPoints[i]) * -1 + randomPoints[i];
//			THREE.QuadraticBezierCurve3 curveSegment1 = new THREE.QuadraticBezierCurve3(randomPoints[i], c, randomPoints[i + 1]);
//			curve.add(curveSegment1);
//		}
        Vector3 centerPosPre;
        Vector3 centerPosNext = Vector3.Lerp(randomPoints[1], randomPoints[2], 0.5f);

        THREE.QuadraticBezierCurve3 curveSegment = new THREE.QuadraticBezierCurve3(randomPoints[0], randomPoints[1], centerPosNext);
        curve.add(curveSegment);

        for (int i = 2; i < randomPoints.Count - 1; i++)
        {
            centerPosPre  = Vector3.Lerp(randomPoints[i - 1], randomPoints[i], 0.5f);
            centerPosNext = Vector3.Lerp(randomPoints[i], randomPoints[i + 1], 0.5f);
            THREE.QuadraticBezierCurve3 curveSegment1 = new THREE.QuadraticBezierCurve3(centerPosPre, randomPoints[i], centerPosNext);
            curve.add(curveSegment1);
        }

        // Spline3
        spline = new THREE.SplineCurve3(randomPoints);

        // ShapePath
        PointList pointList = new PointList();

        shapePath = pointList.GetShapePath(randomPoints.ToArray());
    }
Exemple #3
0
    // Update is called once per frame
    void OnDrawGizmos()
    {
        if(points == null || points.Count < 1){ return; }

        // ShapePath
        pointList = new PointList();

        // ShapePath
        if (pointList != null) {
            shapePath = pointList.GetShapePath(points.ToArray(), rots.ToArray());

            for (int i = 0; i < num; i++) {
                float v = (float)i / num;

                Vector3 pt;
        //				pt = shapePath.getPointInfoVec3Percent(v);
                PathVector pv = shapePath.getPathInfo(v);
                pt = new Vector3(pv.x, pv.y, pv.z);

                Gizmos.color = color;
                Gizmos.DrawWireSphere(pt, 0.25f);

                Quaternion rot = pv.rot;

                //
                Gizmos.color = new Color(0, 0, 0, 0.25f);
                Gizmos.DrawRay(pt, rot * Vector3.up * 2);
                Gizmos.DrawRay(pt, rot * Vector3.right * 2);

                Quaternion q2 = GetQuaternionAt(v);
                Gizmos.color = Color.green;
                Gizmos.DrawRay (pt, q2* Vector3.up);
                Gizmos.color = Color.red;
                Gizmos.DrawRay (pt, q2* Vector3.right);
            }
        }
    }
 void  Awake()
 {
     Debug.LogWarning("------------ ShapePathPlayer ------------");
     path = pointList.GetPathPoints();
     sp   = pointList.GetShapePath();
 }