R
R
Rag'n' Code Man2020-12-07 15:50:12
Physics
Rag'n' Code Man, 2020-12-07 15:50:12

How does trajectory calculation work in games like Angry Birds?

Solving the problem in kinematics, I got the formula for the trajectory of a body thrown from the ground at an arbitrary angle: 5fce23eb3341a718025714.jpeg

But unfortunately, this formula does not take into account either the mass of the body or the force of the throw, and if you use this in Gamedev, then the player’s computer will have to solve a quadratic equation every frame.

How is this implemented on the example of Angry Birds?
There is the force of the throw, there is mg, there is the mass of the bird, but how to write all this into one function so that it is also not very difficult for the player's computer?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Mercury13, 2020-12-07
@iDmitriyWinX

The interaction with another mass depends on the mass of the body.
From the strength of the throw and body weight - the initial speed v.
Most often, they really do not bring to an analytical solution, and each frame there is a step of numerical solution of the differential equation:
(vx, vy)′ = (0, −g) - well, or add air resistance
(x, y)' = (vx, vy)
Google "Runge-Kutta methods", the second order method will suffice for us.

G
GavriKos, 2020-12-07
@GavriKos

then the player's computer will have to solve a quadratic equation every frame.

So what? It's not that hard of a calculation. Especially for core mechanics.

A
Armenian Radio, 2020-12-07
@gbg

A physics textbook for grades 6-7 of a secondary school in your hands and forward, to learn, so to speak.
It costs almost nothing for a modern processor to solve a quadratic equation. Moreover, it can be solved once.

F
freeExec, 2020-12-07
@freeExec

Well, the force of the throw + mass = turn into the initial speed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question