One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

SpatialForceFalloff

struct · iOS 18.0+ · SDK 27.1

struct SpatialForceFalloff

A type that modulates the force strength based on the distance of rigid bodies. Forces applied to rigid bodies near the effect's origin have the largest strength and gradually decay to zero when approaching the boundary of ``ForceEffectBounds``. ``SpatialForceFalloff/rate`` controls how fast the force strength decays. Under the hood the rate is an exponent of the normalized distance over the spatial bounds. For example when the rate is 0, the falloff coefficient (i.e. distance raised to the power of 0) is constantly 1, and that implies no decay or falloff the force strength. ```swift let noFalloff = SpatialForceFalloff(bounds: .sphere(radius: 10), rate: 0) ``` As another example, you can set ``rate`` to `1` to decay the force strength linearly. ```swift let linearFalloff = SpatialForceFalloff(bounds: .sphere(radius: 10), rate: 1) ```

Members (7)

get · iOS 18.0+

distanceOffset

TypeScript
get distanceOffset(): number
Swift declaration
var distanceOffset: Double

A distance from the origin where the falloff begins. Use an offset value that is less than ``bounds``.

set · iOS 18.0+

distanceOffset

TypeScript
set distanceOffset(value: number)
Swift declaration
var distanceOffset: Double

A distance from the origin where the falloff begins. Use an offset value that is less than ``bounds``.

get · iOS 18.0+

rate

TypeScript
get rate(): number
Swift declaration
var rate: Double

The spatial falloff / attenuation rate. An exponent that determines how the effect's strength diminishes with distance. Use a non-negative rate. * When the rate is **0**, no falloff occurs. * When the rate is **greater than 0 and less than 1.0**, falloff occurs slower and is sublinear. * When the rate is **1.0**, falloff is linear. * When the rate is **greater than 1**, falloff occurs faster and is nonlinear.

set · iOS 18.0+

rate

TypeScript
set rate(value: number)
Swift declaration
var rate: Double

The spatial falloff / attenuation rate. An exponent that determines how the effect's strength diminishes with distance. Use a non-negative rate. * When the rate is **0**, no falloff occurs. * When the rate is **greater than 0 and less than 1.0**, falloff occurs slower and is sublinear. * When the rate is **1.0**, falloff is linear. * When the rate is **greater than 1**, falloff occurs faster and is nonlinear.

init · iOS 18.0+

init

TypeScript
static init(bounds: ForceEffectBounds, rate?: number, distanceOffset?: number): SpatialForceFalloff
Swift declaration
init(bounds: ForceEffectBounds, rate: Double = 1.0, distanceOffset: Double = 0)

Creates a spatial force falloff. - Parameters: - bounds: The spatial bounds used to compute the strength falloff. - rate: The rate at which the effect's strength diminishes. - distanceOffset: The offset from the origin where fall begins. * When the rate is **0**, no falloff occurs. (Rigid bodies outside the bounds are culled.) * When the rate is **greater than 0 and less than 1.0**, falloff occurs slower and is sublinear. * When the rate is **1.0**, falloff is linear. * When the rate is **greater than 1**, falloff occurs faster and is nonlinear.

get · iOS 18.0+

bounds

TypeScript
get bounds(): ForceEffectBounds
Swift declaration
var bounds: ForceEffectBounds

The spatial bounds that define the area over which the force effect's strength decreases.

set · iOS 18.0+

bounds

TypeScript
set bounds(value: ForceEffectBounds)
Swift declaration
var bounds: ForceEffectBounds

The spatial bounds that define the area over which the force effect's strength decreases.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →