예제 #1
0
        /// <summary>
        /// Initialization of the component
        /// </summary>
        /// <returns>true if the component is fully initialized</returns>
        public override bool Initialize()
        {
            if (!SourceIsInitialized)
            {
                return(false);
            }

            switch (Mode)
            {
            case FollowMode.AbsoluteExtrapolate:
                UpdateAction = UpdateAbsoluteExtrapolate;
                Initial.Absolute(Spline.Length);
                Current    = new CurvyVector(Initial);
                mCurrentTF = Spline.DistanceToTF(Current.m_Position);
                break;

            case FollowMode.AbsolutePrecise:
                UpdateAction = UpdateAbsolutePrecise;
                Initial.Absolute(Spline.Length);
                Current    = new CurvyVector(Initial);
                mCurrentTF = Spline.DistanceToTF(Current.m_Position);
                break;

            default:
                UpdateAction = UpdateRelative;
                Initial.Relative();
                Current    = new CurvyVector(Initial);
                mCurrentTF = Current.Position;
                break;
            }
            mCurrentSegment    = null;
            mCurrentSegmentF   = 0;
            Transform.position = Spline.Interpolate(mCurrentTF);
            if (SetOrientation)
            {
                orientate();
            }
            return(true);
        }
예제 #2
0
 public CurvyVector(CurvyVector org)
 {
     this.MaxDistance = org.MaxDistance;
     this.m_Position  = org.m_Position;
     this.m_Direction = org.m_Direction;
 }