Parameters used to configure the initial state of a particle when it's spawned in the simulation.
The values specified become initial values in the Initialization stage, which can read or overwrite
the values.
## Usage
```swift
let params = ElementSpawnParameters(
position: SIMD3<Float>(0, 1, 0),
velocity: SIMD3<Float>(0, -1, 0),
size: SIMD2<Float>(0.02, 0.02),
color: SIMD4<Float>(1, 0.5, 0, 1),
lifetime: 2.0
)
```
Members (11)
get · iOS 27.0+
size
TypeScript
get size(): SDKHandle
Swift declaration
var size: SIMD2<Float> { get set }
The initial size of the particle as a 2D vector representing width and height.
For most particle systems, this represents the billboard size in world space units.
- `x` component: width of the particle
- `y` component: height of the particle
Equal values create square particles, while different values create rectangular particles.
set · iOS 27.0+
size
TypeScript
set size(value: SDKHandle)
Swift declaration
var size: SIMD2<Float> { get set }
The initial size of the particle as a 2D vector representing width and height.
For most particle systems, this represents the billboard size in world space units.
- `x` component: width of the particle
- `y` component: height of the particle
Equal values create square particles, while different values create rectangular particles.
get · iOS 27.0+
color
TypeScript
get color(): SDKHandle
Swift declaration
var color: SIMD4<Float> { get set }
The initial color and alpha (transparency) of the particle.
Uses RGBA format where each component ranges from 0.0 to 1.0:
- `x` (red): Red color component
- `y` (green): Green color component
- `z` (blue): Blue color component
- `w` (alpha): Transparency (0.0 = fully transparent, 1.0 = fully opaque)
set · iOS 27.0+
color
TypeScript
set color(value: SDKHandle)
Swift declaration
var color: SIMD4<Float> { get set }
The initial color and alpha (transparency) of the particle.
Uses RGBA format where each component ranges from 0.0 to 1.0:
- `x` (red): Red color component
- `y` (green): Green color component
- `z` (blue): Blue color component
- `w` (alpha): Transparency (0.0 = fully transparent, 1.0 = fully opaque)
get · iOS 27.0+
lifetime
TypeScript
get lifetime(): number
Swift declaration
var lifetime: Float { get set }
The initial lifetime of the particle in seconds.
This determines how long the particle will exist before being automatically removed
from the simulation. A value of 0 or negative means the particle will be removed
immediately or never spawn.
set · iOS 27.0+
lifetime
TypeScript
set lifetime(value: number)
Swift declaration
var lifetime: Float { get set }
The initial lifetime of the particle in seconds.
This determines how long the particle will exist before being automatically removed
from the simulation. A value of 0 or negative means the particle will be removed
immediately or never spawn.
Creates a new set of particle spawn parameters.
- Parameters:
- position: The initial 3D position in world space coordinates
- velocity: The initial velocity vector in world space units per second (defaults to zero)
- size: The initial size as width and height in world space units (defaults to 0.01 x 0.01)
- color: The initial RGBA color (defaults to opaque white)
- lifetime: The particle lifetime in seconds (defaults to 1.0 second)
## Example
```swift
// Create a particle that starts at the origin, moves upward, is red, and lasts 3 seconds
let params = ElementSpawnParameters(
position: SIMD3<Float>(0, 0, 0),
velocity: SIMD3<Float>(0, 2, 0),
size: SIMD2<Float>(0.05, 0.05),
color: SIMD4<Float>(1, 0, 0, 1),
lifetime: 3.0
)
```
get · iOS 27.0+
position
TypeScript
get position(): SDKHandle
Swift declaration
var position: SIMD3<Float> { get set }
The initial 3D position of the particle in world space coordinates.
This determines where the particle will first appear when spawned. The coordinate system
follows RealityKit's conventions with Y pointing up.
set · iOS 27.0+
position
TypeScript
set position(value: SDKHandle)
Swift declaration
var position: SIMD3<Float> { get set }
The initial 3D position of the particle in world space coordinates.
This determines where the particle will first appear when spawned. The coordinate system
follows RealityKit's conventions with Y pointing up.
get · iOS 27.0+
velocity
TypeScript
get velocity(): SDKHandle
Swift declaration
var velocity: SIMD3<Float> { get set }
The initial velocity vector of the particle in world space units per second.
This determines the particle's initial direction and speed of movement. The magnitude
of the vector represents the speed, while the direction represents the movement direction.
A zero velocity means the particle starts stationary.
set · iOS 27.0+
velocity
TypeScript
set velocity(value: SDKHandle)
Swift declaration
var velocity: SIMD3<Float> { get set }
The initial velocity vector of the particle in world space units per second.
This determines the particle's initial direction and speed of movement. The magnitude
of the vector represents the speed, while the direction represents the movement direction.
A zero velocity means the particle starts stationary.