Formula to fly up to a point at different speeds

In summary, you can use a force framework to calculate the net force on an object, which will then determine its momentum and velocity. You then need to supply a mass for the bird and integrate that momentum over time to move it in the desired direction.
  • #1
harleyon
2
0
Hello,

I'm trying to build a game that has birds fly up on the Y axis (I'm ignoring the X axis for now).

What I'm trying to achieve is for the the birds to fly up against gravity (in this case set to 240) to a predefined height and at different speeds.

E.g. Bird1 flies up 400 pixels at a speed of '10'. Bird2 flies up 400 pixels at a speed of '5'.

The variables I can set is 'velocity' and 'acceleration'. I have a gravity factor of 240 trying to push the birds down at all times.

What formula would I use for this?
 
Technology news on Phys.org
  • #2
harleyon said:
Hello,

I'm trying to build a game that has birds fly up on the Y axis (I'm ignoring the X axis for now).

What I'm trying to achieve is for the the birds to fly up against gravity (in this case set to 240) to a predefined height and at different speeds.

E.g. Bird1 flies up 400 pixels at a speed of '10'. Bird2 flies up 400 pixels at a speed of '5'.

The variables I can set is 'velocity' and 'acceleration'. I have a gravity factor of 240 trying to push the birds down at all times.

What formula would I use for this?

Hey harleyon and welcome to the forums.

If you were to use a force framework for physics, what you can do is to create a force vector that always down (i.e. towards the earth). So for 3D it would be towards the negative y-axis.

If you are able to have say a scene where you can 'fly around the earth' then the force vector should point towards the centre of your virtual world: if its flat don't worry about this.

Then for specifics you need to do unit conversion and find the right parameters. The reason is that in games, we don't use 9.8m/s even if the units with respect to the perspective and size of the characters and other objects is right.

So you will need to figure out a ratio for screen units with respect to metres and then specify a coeffecient for your gravity. The force vector then given that positive y points 'up' will be (0,-g * scaling) where the g is your coeffecient for gravitational force and scaling is your scaling calculation to convert metres into game units.

What you do after this is that the bird supplies a force to overcome the gravity and that force will usually depend on the direction of flight from the user. You can (and this is why its better to have this system), add as many forces as you want for things like aerodynamics if you want to add this later.

Once you have this force system, you end up taking all the forces on the object and then you add them together to get the net-force. You then integrate this force into the object itself and it will move in that direction.

You will also need to supply a mass for the bird. Then what happens is you take all of this and you get the momentum over time for the bird and the velocity component is what you use to move the bird.

The momentum is calculated as the integral of the force. Basically what you do is you have a small time value and the momentum increases by F * dt = mv (v is velocity which is a vector). Then given that you know the mass, you then take the velocity and increase the displacement of your object by v * dt (i.e. add this to your velocity) to get your position of your bird and keep doing that each frame of your game.
 
  • #3
... in the meantime :smile:

the additional acceleration is given by

-(u2+2.g.s)/2s)

where u is initial speed, g is background 'gravity' and s is the height.

I think your bird is going to be flapping for a long time, though.
 
  • #4
Great - thanks guys. I'll give it a go.
 
  • #5


I would recommend using the formula for position, velocity, and acceleration in kinematics to calculate the birds' flight. The formula for position is x = x0 + v0t + 1/2at^2, where x is the final position, x0 is the initial position, v0 is the initial velocity, a is the acceleration, and t is the time. In this case, the initial position (x0) would be 0, as the birds are starting from the ground. The final position (x) would be the predefined height that you want the birds to reach. The initial velocity (v0) can be set based on the speed you want the birds to fly at, and the acceleration (a) would be the gravity factor of 240. By plugging in these values and solving for t, you can determine how long it will take the birds to reach the desired height. This formula can be used for both Bird1 and Bird2, with different initial velocities (v0) to achieve the different speeds. I hope this helps with your game development!
 

Related to Formula to fly up to a point at different speeds

1. How does the formula for flying up to a point at different speeds work?

The formula calculates the necessary thrust and angle needed for an aircraft to reach a specific point in space at a desired speed. It takes into account factors such as air resistance, gravitational pull, and the characteristics of the aircraft itself.

2. Is the formula the same for all types of aircraft?

No, the formula may vary depending on the type and size of the aircraft. Different aircraft have different capabilities and characteristics, so the formula may need to be adjusted accordingly.

3. Can the formula be used for flying to points on other planets?

The formula can be adapted for flying to points on other planets, but it may require additional calculations and considerations due to the varying conditions and gravitational forces on different celestial bodies.

4. How accurate is the formula for flying up to a point at different speeds?

The accuracy of the formula depends on the accuracy of the input data and the complexity of the flight path. It is important for scientists and engineers to continuously refine and improve the formula to increase its accuracy.

5. Can the formula be used for other forms of transportation, such as rockets or drones?

The formula can potentially be adapted for other forms of transportation, but it may need to be modified to account for different propulsion methods and environmental factors. Further research and testing would be necessary to determine its applicability for other forms of transportation.

Similar threads

  • Programming and Computer Science
Replies
19
Views
2K
Replies
22
Views
1K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
3
Views
1K
  • Other Physics Topics
Replies
5
Views
2K
  • Introductory Physics Homework Help
Replies
5
Views
2K
Replies
3
Views
1K
Replies
2
Views
1K
Replies
14
Views
2K
Back
Top