11-21-2024, 02:38 PM
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:
Then i tried a simple exercise to test my hypothesis with this debug code:
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 !
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 !

