# Inconsistent Speed Of A Projectile Traveling On A Bezier Curve

What I'm doing:

I'm moving a projectile to it's target along a Bézier curve with one control point.

The projectile moves from Transform A to Transform B with the curve created by control's Transform's position. I'm using this method so that I can change how the projectile's arc or path looks depending on the enemy's position.

The issue:

The projectile travels from A to B successfully, however, my issue is depending on the curve the speed can be inconsistent and an unwanted 'easing' effect can occur.

Here's an example in the image below. Because of control's position, you can see the wirespheres begin to bunch up and smoosh together. As the projectile travels from A to B, it will gradually move slower as the wirespheres become closer together.

Here are the two scripts I am using to accomplish this:

public class QuadraticCurve : MonoBehaviour
{
public Transform A;
public Transform B;
public Transform Control;

public Vector3 evaluate(float t)
{
Vector3 ac = Vector3.Lerp(A.position, Control.position, t);
Vector3 cb = Vector3.Lerp(Control.position, B.position, t);
return Vector3.Lerp(ac, cb, t);
}

private void OnDrawGizmos()
{
if(A == null || B == null || Control == null)
{
return;
}

for (int i = 0; i < 20; i++)
{
Gizmos.DrawWireSphere(evaluate(i / 20f), 0.1f);
}
}
}


public class ProjectileAttack: MonoBehaviour
{

private IEnumerator MoveTheDart()
{
// Set the target
_curve.B.transform.position = ImpactPosition.position;

while (sampleTime < 1f)
{
sampleTime += Time.deltaTime * newSpeed;
projectile.position = curve.evaluate(sampleTime);
yield return null;
}
}
}


What I need assistance with:

I believe v1= ac & v2 = cb. Would L be a number I pick that would decide how much it moves each frame?(almost like speed)

I imagine Length is separate from L. If so, what would Length be?

Thank you so much to anyone taking the time!😊

• Just to help with confustion, I believe that's how the answer provided in the mentioned above post should be interpreted: - L is the speed at which objects is moved each simulation step - length in the denominator is not a variable, but a function. So it should be read as divide L by length of vector (t * v1 + v2). Also, I am not sure why you've assumed v1 = ac & v2 = cb. These vectors are parts of curve's deriviative, and, if I am reading that correctly, should be: v1 = 2 * A.position - 4 * Control.position + 2 * B.position, and v2 = -2 * A.position + 2 * Control.position Commented Nov 27, 2023 at 0:30