How the aiming feature works on angry birds

Hi,

Can you please guide me to understand the aiming feature on a game like Angry Bird?

regard,

You need some sort of projectile trajectory prediction.

Exact algorithm heavily depends on how your projectile (in this case, a bird) works.

For an example on how to achieve this you can read this article by KidsCanCode: Draw trajectory :: Godot 3 Recipes

Or watch this video which is based on that article: https://www.youtube.com/watch?v=Mry6FdWnN7I

My question is just this curved line part that you can see in the image:

My engine isn’t godot, so can you please help me with algorithm?

If you are not using Godot, then you are in a wrong place to ask questions.

If you need help in implementing this in some other engine you’d better ask at https://gamedev.stackexchange.com/ or at your engine-related community.

We just discussed this internally and decided to allow game engine agnostic questions. So as long as this isn’t “how to do it in engine XYZ” this is perfectly fine :sparkles:

Game engine agnostic questions are helpful for everyone, including Godot users.

What we don’t want is providing support for other engines, that would be out of scope for this forum.

6 Likes

If you want to calculate the displacement of a projectile as in Angry Birds, you need to calculate a ballistic trajectory.
In 2D with Y axis downward (like in Godot) you have:

θ = intial_velocity_angle
x = intial_veloity * cos(θ) * time
y = 0.5 * gravity * time^2 - intial_veloity * sin(θ) * time - initial_heigth

You can read about it on Wikipedia: Ballistic motion

3 Likes

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?

what do you mean by the time word? Do we expect the bullet or bird to collide with the obstacles at this time?
Where should we place the pixels?

We can not help you with collisions as you do not use Godot. You need to ask in the community for the Engine/Framework you use.

It’s fine to ask for general math advice like you did, but we can’t give you specific answers outside of Godot.

Assume I use Godot. I will understand.
Even if you give a very general explanation, I will understand
​Just the alguryrhim is important for me.