Пример #1
0
    public void UpdateObj()
    {
        // Update the speed and position of this object
        currentPosOnCurve += speed;
        if (currentPosOnCurve > currentNode.curveLength)
        {
            ChangeNode();
        }

        // Calculate the time along the curve
        timeAlongCurve = currentPosOnCurve / currentNode.curveLength;

        // Set the rotation and the posistion of the object
        transform.position = currentNode.GetCurvePoint(timeAlongCurve);
        transform.rotation = Quaternion.LookRotation(currentNode.GetCurveDirection(timeAlongCurve));
    }