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

# DistanceAttenuation.Custom

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.Custom) 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.Custom implements DistanceAttenuation
```

<br />

*** ** * ** ***

Configures a custom distance attenuation model

| 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 |
|---|
| `Custom( float minDistance, float maxDistance, float gainAtMaxDistance, float rolloffFactor )` |

| ### 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). |
| `final float` | `getRolloffFactor()` Custom curve shape: \< 0 for inverse, \> 0 for parabolic, 0 for linear. |
| `int` | `hashCode()` |
| `@NonNull String` | `toString()` |

## Public constructors

### Custom

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

```
public Custom(
    float minDistance,
    float maxDistance,
    float gainAtMaxDistance,
    float rolloffFactor
)
```

| Parameters |
|---|---|
| `float minDistance` | Distance where attenuation begins (gain is 1.0). Must be \>= 0.1. |
| `float maxDistance` | Distance where attenuation reaches its maximum. Must be \> minDistance. |
| `float gainAtMaxDistance` | Gain at `maxDistance`. Must be in range 0.0, 1.0. |
| `float rolloffFactor` | Custom curve shape: \< 0 for inverse, \> 0 for parabolic, 0 for linear. |

## 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. Must be \> minDistance.

### 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.

### getRolloffFactor

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

```
public final float getRolloffFactor()
```

Custom curve shape: \< 0 for inverse, \> 0 for parabolic, 0 for linear.

### hashCode

```
public int hashCode()
```

### toString

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