← Documentation Home

SetParticleAttraction

Category: Particle Effects (Pro)

Back to System Functions


Signature

SetParticleAttraction(system As Integer, strength As Double)

Returns

Void

Description

Enables particle-to-particle attraction for positive values or repulsion for negative values. Pass 0 to disable it.

Performance and behavior

The runtime automatically uses a symmetric direct solver for small groups and an adaptive multipole quadtree for large groups. The tree subdivides only occupied regions, directly evaluates nearby particles, and approximates well-separated groups. Dense terminal leaves, including particles emitted at exactly the same position, are evaluated as a self-excluding center of mass so clustered effects do not fall back to quadratic work. Softening prevents singular forces at zero separation.

Pro feature: compiling code that uses this function requires a license with the GamePhysics feature enabled.

Example

SetParticleAttraction particles, 900