# Help with Fuel burn/Acceleration ratio equation

I need help to figure out the equation for my ship's fuel burn ratio....

I am not measuring the ships speed, but instead its acceleration. In fact the user doesn't not even enter a speed, they simply enter the desired travel time and it gets measured in a ratio from 0 to 1 (start to finish). I then have a conversion to game units - which when all said and done gives me a pseudo Metres p/s measurement. For example, *Travel from Here to there in 3 days will required 0.5G's*

Also, the ship does a flip at 0.5 of the journey and applies the same acceleration rate in the opposite direction to bring it to a stop by 1.0 (basic space travel principal)

So now I want to implement a fuel system and have the ship burn fuel at 100% efficiency at a particular rate, but get less efficient as it accelerates faster and then become more efficient at really slow accelerations.

Here are my *knowns* : **Travel Time (t)** (entered by the user in days) **Destination (d)** (entered by user, can get vector3 from this)**Acceleration** (not directly entered by user, but determined from (t) and (d)**Fuel (f)** (not implemented yet, but would like to have user enter an **int** not a float *(as in, user has 100 fuel pellets, but each fuel pellet provides x amount acceleration for certain number of days)***100% efficiency rate (e)** (The number of G's at which the ship is using 1 pellet per 1 day whilst accelerating)

Anyway, a lot of the existing maths I have was done by a colleague, not me, so this might be simple, but I was too busy drawing cartoons in high school maths class, so I need help.

Thank you

**Answer** by Bunny83
·
Apr 25, 2018 at 02:46 AM

Well you haven't specifed any reasonable relation between fuel burn rate and acceleration. I'm also not sure why you said the user should input the amount of fuel. Since you specify the travel time and distance everything else would depend on that given that you have an idea how you actually want the efficiency change. There are countless ways. It could change linearly, quadratic, exponentially, based on a custom curve (AnimationCurve).

Generally you determine the total distance (d) to your target and the user specifies the desired travel time. The relation between acceleration (a), time (t) and distance (d) is this:

```
d/2 = 0.5 * a * t²
```

Since we accelerate at a constant rate we only have to take half the way into account. So just simplify and solve for "a":

```
d = a * t²
a = d / t²
```

So this gives you the required acceleration to travel distance "d" in time "t" if you constantly accelerate for the first half of the way and constantly decelerate during the second half.

As i said how you map your fuel to this is completely arbitrary. The relation between "t" and "a" is inverse quadratic. So if you want half the travel time you need 4 times the acceleration. If you have a linear one-to-one relation between fuel and acceleration you would also need 4 times as much fuel. So if you want to travel twice as fast you need 4 times the fuel. This of course does not yet considering any efficiency change. The question is if you actually need / want such a change as changing the travel time does naturally makes the trip more expensive or cheaper.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

Player object accelerates??? C# Unity2D 0 Answers

Accelerate 1 Answer

How i make my player object passes through walls? 2 Answers

Numbers not matching up on journey between two points 0 Answers