Answer the question
In order to leave comments, you need to log in
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:
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
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.
then the player's computer will have to solve a quadratic equation every frame.
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question