コード例 #1
0
        /// <summary>
        /// Rebuild renderer base curve.
        /// </summary>
        /// <param name="curve"></param>
        public override void Rebuild(IMonoCurve curve)
        {
            if (curve == null || curve.Length == 0)
            {
                Segments = 0;
                lineRenderer.SetVertexCount(0);
                return;
            }

            Segments = MonoCurveUtility.GetSegmentCount(curve, segment, out float differ) + 1;
            lineRenderer.SetVertexCount(Segments);
            for (int i = 0; i < Segments; i++)
            {
                lineRenderer.SetPosition(i, curve.LocalEvaluate(i * differ));
            }
        }
コード例 #2
0
 /// <summary>
 /// Rebuild collider for mono curve.
 /// </summary>
 protected override void RebuildCollider(IMonoCurve curve)
 {
     Segments = MonoCurveUtility.GetSegmentCount(curve, segment, out float differ);
     RequireCapsules(Segments);
     SetCapsules(curve, Segments, differ);
 }