# Controlling Speed

Different computers run at different speeds. The best way to account for this is to always multiply your transform code by Time.deltaTime.

Speed can be stored in its own variable to update with ease and is generally multiplied or divided when updating the transform.

Examples:

```csharp
// Define public global variables
// These will appear in the Inspector tab
public float speed = 3.5F;
public Vector3 destination;

// Only runs once
void Start()
{

    // Initialize the destination location
    destination = new Vector3(20.0F, 0, 0);
}
    
// Runs each frame
void Update()
{

    // Example of updating position
    transform.position += new Vector3(1.0F, 0, 0) * speed * Time.deltaTime;

    // Example of using Translate()
    transform.Translate(new Vector3(1.0F, 0, 0) * speed * Time.deltaTime);

    // Example of using Vector3.Lerp()
    transform.position = Vector3.Lerp(transform.position, destination, speed * Time.deltaTime);

}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hopemoore.gitbook.io/unity-basics/translate-rotate-and-scale/controlling-speed.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
