BezierSpline.GetDirection C# (CSharp) Method

GetDirection() public method

public GetDirection ( float t ) : Vector3
t float
return Vector3
    public Vector3 GetDirection(float t)
    {
        return GetVelocity (t).normalized;
    }

Usage Example

コード例 #1
0
    public Transform[] CreateSpline(int objectsCount)
    {
        DeleteInstances();

        count = objectsCount;

        if (count <= 0)
        {
            return(null);
        }
        if (spline.Loop || count == 1)
        {
            stepSize = 1f / count;
        }
        else
        {
            stepSize = 1f / (count - 1);
        }

        Array.Resize(ref instances, count);

        for (int i = 0; i < count; i++)
        {
            instances[i] = Instantiate(item) as Transform;
            Vector3 position = spline.GetPoint(i * stepSize);
            instances[i].transform.localPosition = position;
            if (lookForward)
            {
                instances[i].transform.LookAt(position + spline.GetDirection(i * stepSize));
            }
            instances[i].transform.parent = transform;
        }

        return(instances);
    }
All Usage Examples Of BezierSpline::GetDirection