Esempio n. 1
0
        private void Update()
        {
            Progress += (m_speedNorm * Time.deltaTime);
            Progress %= 1f;

            float2 pos = Spline.Get2DPointWorld(Progress);

            transform.position = new Vector3(pos.x, pos.y, 0f);
        }
Esempio n. 2
0
        /// <summary>
        /// Renders points along the spline to demonstrate possible point bunching along the splines length
        /// </summary>
        /// <param name="quantity">amount of points to render</param>
        /// <param name="spline">spline to render on</param>
        protected static void RenderIntermediateSplinePoints(float quantity, ISpline2D spline)
        {
            Handles.color = Color.red;
            const float multiplier = 0.3f;

            for (int i = 0; i <= quantity; i++)
            {
                float progress = i == 0 ? 0f : i / (quantity - 1f);
                HandleDrawPlus(spline.Get2DPointWorld(progress), multiplier);
            }
        }