I am following a guide on how to play a flappy bird clone in the LibGdx framework. -http://www.kilobolt.com/day-5-the-flight-of-the-dead---adding-the-bird.html
I am currently on the part where the author discusses adding the actual bird and the physics behind the bird. He encapsulates the state of the bird with these instance variables
private Vector2 position;
private Vector2 velocity;
private Vector2 acceleration;
private float rotation; // For handling bird rotation
private int width;
private int height;
and he initializes these instance variables or fields inside the constructor
public Bird(float x, float y, int width, int height) {
this.width = width;
this.height = height;
position = new Vector2(x, y);
velocity = new Vector2(0, 0);
acceleration = new Vector2(0, 460);
}
The author explained that the 460 constant acceleration in the y direction is due to gravity, that is earth's gravity causes an object to speed up by 9.8m/s every second or 9.8m/s^2.
When asked how he determined the 460, the author responded, "Acceleration was experimentally determined. Its value does not change."
My question is how would you go about experimenting for this value? What information would you use. I think really understanding the process behind this experimentation would be valuable for developers who are trying to incorporate gravity in their applications.
I think this 460 would be in terms of the game units, where the author, james, earlier defined as cam.setToOrtho(true, 136, 204);
By "experimentally determined," the author just means trying various values until finding something that worked. There's no math or complex magic here. To experiment with it, just change it and run the program again. If you like what you see, use it. If not, adjust it accordingly.
The number of 9.8 m/s² is just a reference to how Earth's gravity works. It has nothing to do with the actual game's implementation.