Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rasterized Path Range issue
#1
Hi, I want to deform a spring mesh along a spline, and animate Rasterized Path's From/To property to create a stretch animation, but the Curvy Generator always throws ArgumentNullException. After some investigation, I found when set To=1, it's actual value becomes 0, and From is also 0,so the CGPath is null. In the BuildRasterizedPath.cs, I see From/To property make some clamp for value:

Code:
public float From
{
    get => m_Range.From;
    set
    {
        float v = DTMath.Repeat(
            value,
            1
        );
        if (m_Range.From != v)
        {
            m_Range.From = v;
            Dirty = true;
        }
    }
}

public float To
{
    get => m_Range.To;
    set
    {
        float v = Mathf.Max(
            From,
            value
        );
        if (ClampPath)
            v = Mathf.Repeat(
                value,
                1
            );
        if (m_Range.To != v)
        {
            m_Range.To = v;
            Dirty = true;
        }
    }
}

From use a specific DTMath.Repeat to clamp the value, which keep 1 for 1, but To still use Mathf.Repeat, which make 1 becomes 0. After replace Mathf.Repeat with  DTMath.Repeat, it can work normally. So should it be DTMath.Repeat too for To property?

In addition, when set From and To with same value, which means Length = 0, the Generator always throws ArgumentNullException, I guess when the Length = 0,  CGPath always is null. Can it generate a empty path/mesh, otherwise I have to keep a small distance between From and To to avoid the ArgumentNullException.

Beside, To use Mathf.Max(From, value) to make sure it >= From, but the From don't have such check. So when set the range, To must set after From. Should From also do the same?

Thanks.
Reply


Messages In This Thread
Rasterized Path Range issue - by proton - 04-12-2024, 04:00 PM
RE: Rasterized Path Range issue - by _Aka_ - 04-15-2024, 01:52 PM
RE: Rasterized Path Range issue - by _Aka_ - 04-15-2024, 03:42 PM
RE: Rasterized Path Range issue - by proton - 04-27-2024, 09:26 AM
RE: Rasterized Path Range issue - by _Aka_ - 04-29-2024, 10:44 AM
RE: Rasterized Path Range issue - by _Aka_ - 04-29-2024, 12:24 PM
RE: Rasterized Path Range issue - by proton - 04-30-2024, 05:13 AM
RE: Rasterized Path Range issue - by _Aka_ - 04-30-2024, 11:17 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Spline Issue Leading to Unity Freeze Pankaj09 1 325 08-24-2026, 11:28 PM
Last Post: _Aka_
  Connecting Multiple Spline Nodes Issue Ritesh Kadam 1 281 08-22-2026, 11:24 PM
Last Post: _Aka_
  Duplicate Prefab along path rickgplus 1 1,919 01-23-2025, 10:09 AM
Last Post: _Aka_
  Can't set CG Path Controller j95677 4 4,051 10-04-2024, 06:55 PM
Last Post: j95677

Forum Jump: