distanceOffset
TypeScriptget distanceOffset(): numberSwift declarationvar distanceOffset: DoubleA distance from the origin where the falloff begins. Use an offset value that is less than ``bounds``.
struct · iOS 18.0+ · SDK 27.1
struct SpatialForceFalloffA 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) ```
get distanceOffset(): numberSwift declarationvar distanceOffset: DoubleA distance from the origin where the falloff begins. Use an offset value that is less than ``bounds``.
set distanceOffset(value: number)Swift declarationvar distanceOffset: DoubleA distance from the origin where the falloff begins. Use an offset value that is less than ``bounds``.
get rate(): numberSwift declarationvar rate: DoubleThe 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 rate(value: number)Swift declarationvar rate: DoubleThe 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.
static init(bounds: ForceEffectBounds, rate?: number, distanceOffset?: number): SpatialForceFalloffSwift declarationinit(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 bounds(): ForceEffectBoundsSwift declarationvar bounds: ForceEffectBoundsThe spatial bounds that define the area over which the force effect's strength decreases.
set bounds(value: ForceEffectBounds)Swift declarationvar bounds: ForceEffectBoundsThe spatial bounds that define the area over which the force effect's strength decreases.
No declarations were skipped in this snapshot.