Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Angle detection by tangent
#6
Hello again !

I'm sorry but i have another interrogation, this time is about my ahead target.
I seem to notify that the distance with my ahead target is not constant and I'm not sure to understand why.

Here my code to compute my ahead offset relative position with a _aheadFixedOffset = 1:
Code:
 
private float AheadRelativePosition => RelativePosition + _aheadOffset;

protected override void OnValidate()
    {   
        _aheadOffset = _aheadFixedOffset / Spline.Length;
    }
 

Then i tried a simple exercise to test my hypothesis with this debug code:
Code:
   
private void OnDrawGizmos()
    {
        Gizmos.color = Color.magenta;
        Gizmos.DrawWireSphere(GetInterpolatedSourcePosition(AheadRelativePosition), 0.5f);

        var distance = Vector3.Distance(GetInterpolatedSourcePosition(RelativePosition), GetInterpolatedSourcePosition(AheadRelativePosition));
        Debug.Log($"Distance with ahead target: {distance} at Relative pos: {RelativePosition} with ahead relative pos: {AheadRelativePosition}");
}

As you can see in the picture bellow, the distance between the tracker is variable for different relative positions.
In my understanding of the situation it should be the same, since the  _aheadOffset is a constant value.

My assumption is that this difference come from the fact that the points on the spline are not equally spread.

Have you an idea of how i can have an ahead target at a constant distance from my spline follower ?

Thanks again !


Attached Files Thumbnail(s)
           
Reply


Messages In This Thread
Angle detection by tangent - by Skuuulzy - 11-18-2024, 11:31 AM
RE: Angle detection by tangent - by _Aka_ - 11-18-2024, 04:30 PM
RE: Angle detection by tangent - by Skuuulzy - 11-20-2024, 02:38 PM
RE: Angle detection by tangent - by Skuuulzy - 11-20-2024, 03:59 PM
RE: Angle detection by tangent - by _Aka_ - 11-21-2024, 08:40 AM
RE: Angle detection by tangent - by Skuuulzy - 11-21-2024, 02:38 PM
RE: Angle detection by tangent - by _Aka_ - 11-22-2024, 10:47 AM
RE: Angle detection by tangent - by Skuuulzy - 11-27-2024, 01:20 PM
RE: Angle detection by tangent - by _Aka_ - 11-28-2024, 09:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Bug Corner Angle Revisited SAMYTHEBIGJUICY 10 6,148 01-02-2024, 10:12 AM
Last Post: _Aka_
  How can I find the point on the spline after applying with offset angle+radius? Chanon 1 1,443 10-01-2022, 11:50 AM
Last Post: _Aka_
  Tangent incorrect. tairoark 3 2,517 06-28-2022, 06:31 PM
Last Post: _Aka_
  Make hard angle cll3m 5 4,343 07-01-2021, 04:06 PM
Last Post: _Aka_

Forum Jump: