> Documentation index: https://developer.android.com/reference/llms.txt

# DistanceAttenuation.Linear

Artifact: [androidx.xr.scenecore:scenecore](https://developer.android.com/jetpack/androidx/releases/xr-scenecore.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/xr/scenecore/DistanceAttenuation.kt+class:androidx.xr.scenecore.DistanceAttenuation.Linear) Added in [1.1.0-alpha02](https://developer.android.com/jetpack/androidx/releases/xr-scenecore.md.txt#1.1.0-alpha02)

*** ** * ** ***


```
@RequiresSpatialApi(value = 4)
public final class DistanceAttenuation.Linear implements DistanceAttenuation
```

<br />

*** ** * ** ***

Configures linear rolloff between `minDistance` and `maxDistance`.

| Throws |
|---|---|
| `IllegalArgumentException` | if minDistance is less than 0.1, maxDistance is less than minDistance or gainAtMaxDistance is not between 0.0 and 1.0 |

## Summary

| ### Public constructors |
|---|
| `Linear(float minDistance, float maxDistance, float gainAtMaxDistance)` |

| ### Public methods |
|---|---|
| `boolean` | `equals(Object other)` |
| `final @FloatRange(from = 0.0, to = 1.0) float` | `getGainAtMaxDistance()` Gain at `maxDistance`. |
| `final @FloatRange(from = 0.1) float` | `getMaxDistance()` Distance where attenuation reaches its maximum. |
| `final @FloatRange(from = 0.1) float` | `getMinDistance()` Distance where attenuation begins (gain is 1.0). |
| `int` | `hashCode()` |
| `@NonNull String` | `toString()` |

## Public constructors

### Linear

Added in [1.1.0-alpha02](https://developer.android.com/jetpack/androidx/releases/xr-scenecore.md.txt#1.1.0-alpha02)

```
public Linear(float minDistance, float maxDistance, float gainAtMaxDistance)
```

| Parameters |
|---|---|
| `float minDistance` | Distance where attenuation begins (gain is 1.0). Must be \>= 0.1. |
| `float maxDistance` | Distance where attenuation reaches its maximum. |
| `float gainAtMaxDistance` | Gain at `maxDistance`. Must be in range 0.0, 1.0. |

## Public methods

### equals

```
public boolean equals(Object other)
```

### getGainAtMaxDistance

Added in [1.1.0-alpha02](https://developer.android.com/jetpack/androidx/releases/xr-scenecore.md.txt#1.1.0-alpha02)

```
public final @FloatRange(from = 0.0, to = 1.0) float getGainAtMaxDistance()
```

Gain at `maxDistance`. Must be in range 0.0, 1.0.

### getMaxDistance

Added in [1.1.0-alpha02](https://developer.android.com/jetpack/androidx/releases/xr-scenecore.md.txt#1.1.0-alpha02)

```
public final @FloatRange(from = 0.1) float getMaxDistance()
```

Distance where attenuation reaches its maximum.

### getMinDistance

Added in [1.1.0-alpha02](https://developer.android.com/jetpack/androidx/releases/xr-scenecore.md.txt#1.1.0-alpha02)

```
public final @FloatRange(from = 0.1) float getMinDistance()
```

Distance where attenuation begins (gain is 1.0). Must be \>= 0.1.

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```