Exemple #1
0
        public void OnEnable()
        {
            trav = GetComponent <SplineTraveler>();
            if (trav == null)
            {
                Debug.LogError("No SplineTraveler");
            }

            switch (offsetMode)
            {
            case GenerateOffsetMode.OnEnableRelativeOrigin:
                offsetPosition = transform.position;
                break;

            case GenerateOffsetMode.OnEnableRelativeFirstNode:
                Transform nodeZeroTrans = trav.spline.GetNode(0).transform;
                offsetPosition = transform.position - nodeZeroTrans.position;
                break;
            }
        }