# Angry Birds style aiming (ballistic trajectory)

Could you please provide guidance on how to create the curved part?

regard,

• Does this answer your question? Calculate initial velocity for trajectory given duration, launch angle, and distance Dec 13, 2023 at 22:21
• When I search for "gdevelop projectile" I get plenty of promising leads, including extensions built for this purpose and video tutorials. Similarly, searching "gdvelop angry birds" leads to forum posts and videos about implementing exactly this. Can you show us how you've tried applying what you've learned from your research so far, and where specifically you're stuck or need help with an aspect that's not already covered in existing documents? Dec 14, 2023 at 1:54
• Can you name one of those extensions? Dec 15, 2023 at 15:44

## 1 Answer

This is basic gaming physics.

There are two general solutions. The first is call "analytical" or closed form, as it is a single equation that can give you the position of the particle/bird at any time t. See here for more:

x(t) = x0 + v0 * t + 0.5g * t^2

Where x0 is the starting position, v0 is the staring velocity, g is gravity, and t is time.

The second is approach is numerical, which is much more common in games because it allows for a lot more variety in what happens. In this approach there is an integration loop, often the game loop itself, that marches the particle/bird forward in time. Based on the current position, velocity, forces, it computes the position and velocity at the next time step:

a(t) = SUM forces(t) / mass
v(t+1) = v(t) + a(t) * dt
x(t+1) = x(t) + v(t) * dt

Each equation gives the value at the next time step based on the current time step. Position is updated by velocity. Velocity is updated by acceleration. Acceleration is the sum of all forces acting on the bird - in the simplest case just gravity. The acceleration a(t) is just a rewrite of Newton's 2nd law, F=ma. Doing this on every timestep moves the bird along the trajectory.

The reason this second, numerical, approach is much more common is greater flexibility. If your bird hits a building, or is knocked off course, or bounces on the ground, then you just introduce some new forces at any time. This would be much harder to do with a closed form approach.

It can be worthwhile to experiment with both when learning since you discover a lot about physics. There are many articles out there on basic game physics.
Link: https://www.toptal.com/game/video-game-physics-part-i-an-introduction-to-rigid-body-dynamics

• In this 'x(t) = x0 + v0 * t + 0.5g * t^2 ' what do you mean by the time word? Will the bird collide with the obstacles at this time? Where should we place the pixels? Dec 15, 2023 at 22:34
• The equation gives you the position of the bird at any time t. You plug in the time t that you want, usually the current frame time, and it tells you where along the parabola the bird is. It is not the collision time. If you want collisions the numerical approach is better. Dec 17, 2023 at 2:10