> For the complete documentation index, see [llms.txt](https://axongenesis.gitbook.io/timeflow/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://axongenesis.gitbook.io/timeflow/reference/behaviors/automation/distance.md).

# Distance

Calculates distance between objects and optionally applies scale

{% embed url="<https://youtu.be/L6nLRE9mBog>" %}

This is a simple behavior used to calculate distance (in world coordinates) between 2 objects. The resulting value can be scaled and optionally applied to the object transform scale.

{% hint style="success" %}
To apply Distance, right-click an object in the Timeflow view and select:

**Add Automation > Distance**
{% endhint %}

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FX32dH6UKuIkTrBIz8pem%2Fimage.png?alt=media&amp;token=ffa91531-fab8-49b5-9270-d5fb94029ea1" alt=""><figcaption><p>Distance creates a single channel outputting the value calculated.</p></figcaption></figure>

{% hint style="info" %}
Distance only calculates the value and has no effect on objects, unless [Apply To Transform](#apply-to-transform) is enabled.
{% endhint %}

## Distance Editor

<figure><img src="https://2067910529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FC3dOuetlQfYgK5FPUKgn%2Fuploads%2FDtX74RNaYgRyQL7oBkfH%2Fimage.png?alt=media&amp;token=9df0db2b-5d93-4788-9cab-c5ad88b16903" alt=""><figcaption></figcaption></figure>

For common features please refer to [Menu Bar](/timeflow/user-guide/timeflow-editor/menu-bar.md) and [Update Settings](/timeflow/user-guide/timeflow-editor/update-settings.md).

### From / To

Assign the transforms to calculate distance between. These may be anywhere in the scene hierarchy. Distance is calculated in world coordinates.

{% hint style="info" %}
If From or To are left unassigned, the current object transform is used.
{% endhint %}

### Scale

Multiplies the distance to scale the output value. If accurate distance measurements are needed, leave this value at 1.

### Apply To Transform

Enable this to apply the output value to the current object's transform scale. This may be used to create dynamic scaling objects for special effects and UI elements.

{% hint style="info" %}

### Constant Size in Camera

One use case for Distance is to maintain the size of an object as it appears in camera by scaling the object by its distance from the camera. No matter how far away or close the object gets, its size onscreen remains fixed.&#x20;
{% endhint %}
