Skip to main content
Drnichol
Participant
Jul 16, 2026 9:09 AM UTC
Answered

How do I calculate projectile motion between two coordinates?

I'm working on a simple projectile motion system and I'm trying to calculate the trajectory between two points.

I know the starting position (x1, y1) and the target position (x2, y2), but I don't know the launch angle or the initial velocity. The start and target positions can change every time, so I can't use fixed values.

What is the best mathematical approach or algorithm to calculate the correct launch angle and speed so the projectile reaches the target accurately? If there are multiple solutions or common methods, I'd appreciate an explanation or an example.

Thank you!

    Mathias Moehl
    Mathias MoehlCorrect answer
    Community Expert
    Jul 18, 2026 9:42 AM UTC

    The problem is underdetermined: knowing only the start and target positions is not enough to calculate one unique launch angle and speed.

    You need one additional constraint, such as flight time, launch speed, angle, or maximum height. Depending on that choice, there may be multiple valid trajectories.

    ​@ShiveringCactus ’ answer is a helpful practical example: It resolves the ambiguity by assuming a fixed flight duration and arc height, although using ease() means the result is visually convincing rather than strictly physically accurate.

    For After Effects, my extension Easy Bounce is also a practical solution: you set the start, end, and approximate highest point, and it adjusts the motion path and timing to create a believable ballistic trajectory. 

    Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

    5 replies

    Participant
    Aug 7, 2026 8:29 PM UTC

    Bei solchen Aufgaben finde ich es hilfreich, die einzelnen Werte zuerst sauber zu berechnen und anschließend mit einem Online-Calculator zu überprüfen. Für Prozentwerte nutze ich zum Beispiel einen Prozentrechner, während ich bei der Projectile-Motion-Berechnung die Werte für Geschwindigkeit, Winkel und Koordinaten getrennt einsetze. So lassen sich Rechenfehler leichter erkennen und die Ergebnisse besser nachvollziehen.

    Translate
    Mathias Moehl
    Community Expert
    Mathias MoehlCommunity ExpertCorrect answer
    Community Expert
    Jul 18, 2026 9:42 AM UTC

    The problem is underdetermined: knowing only the start and target positions is not enough to calculate one unique launch angle and speed.

    You need one additional constraint, such as flight time, launch speed, angle, or maximum height. Depending on that choice, there may be multiple valid trajectories.

    ​@ShiveringCactus ’ answer is a helpful practical example: It resolves the ambiguity by assuming a fixed flight duration and arc height, although using ease() means the result is visually convincing rather than strictly physically accurate.

    For After Effects, my extension Easy Bounce is also a practical solution: you set the start, end, and approximate highest point, and it adjusts the motion path and timing to create a believable ballistic trajectory. 

    Translate
    Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
    ShiveringCactus
    Community Expert
    Community Expert
    Jul 16, 2026 1:30 PM UTC

    Decades ago, someone made a tank game in After Effects.  I’ve been trying to find it.   

    But in the meantime, I think this expression should work:

    // 1. Reference layers
    targetLayer = thisComp.layer("Target NULL");
    targetPos = targetLayer.transform.position;

    // Use 'valueAtTime' on the layer's static/keyframes position at the In Point
    startPos = position.valueAtTime(inPoint);

    // 2. Define duration and map "time" to a progress variable "t" (0 to 1)
    duration = 1; // Flight duration in seconds
    t = clamp((time - inPoint) / duration, 0, 1);

    // 3. Linear interpolation using our normalized 't'
    linearX = ease(t, 0, 1, startPos[0], targetPos[0]);
    linearY = ease(t, 0, 1, startPos[1], targetPos[1]);

    // 4. Calculate the arc height (parabola) using 't'
    arcHeight = 300;
    parabola = 4 * t * (1 - t) * -1 * arcHeight;

    // 5. Combine linear path with the vertical arc offset
    [linearX, linearY + parabola]

    It’s not perfect, but might be a starting point to adapt

    Translate
    ShiveringCactus
    Community Expert
    Community Expert
    Jul 16, 2026 1:31 PM UTC

    ​@Nishu Kushwaha - just noticed the Code layout that matches AE’s.  Nice.

    Translate
    Nishu Kushwaha
    Community Manager
    Community Manager
    Jul 20, 2026 4:02 PM UTC

    Yah! That’s really convenient.

    Translate