> For the complete documentation index, see [llms.txt](https://docs.decentraland.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.decentraland.org/creator/content-creator-ko/sdk7/3d/particle-system.md). Agents can also search and read this documentation through its [MCP server](https://docs.decentraland.org/~gitbook/mcp).

# 파티클 시스템

불, 비, 불꽃, 마법 오라 같은 파티클 효과를 씬에 추가합니다

파티클 시스템을 사용하면 다수의 작은 스프라이트를 방출하고 애니메이션하여 역동적인 시각 효과를 만들 수 있습니다. 정적 메시로 구현하기 어려운 불, 연기, 비, 눈, 불꽃, 마법 오라, 폭발을 비롯한 다양한 효과를 만드는 데 활용하세요.

## 파티클 시스템 추가

장면에 파티클 시스템을 추가하려면 엔터티를 만들고 다음을 연결합니다: `ParticleSystem` 컴포넌트

```ts
import { engine, Transform, ParticleSystem } from '@dcl/sdk/ecs'
import { Vector3 } from '@dcl/sdk/math'

const emitter = engine.addEntity()

Transform.create(emitter, {
	position: Vector3.create(8, 1, 8),
})

ParticleSystem.create(emitter, {})
```

속성을 설정하지 않으면 컴포넌트는 모든 기본값을 사용합니다. 초당 파티클 10개를 방출하는 점 방출기이며, 파티클의 수명은 5초입니다.

## 이미터 모양

이미터 모양에 따라 파티클이 생성되는 위치가 결정됩니다. 다음을 통해 네 가지 모양을 사용할 수 있습니다. `ParticleSystem.Shape` 헬퍼.

### 점

파티클은 하나의 점(엔티티의 위치)에서 생성됩니다. 모양을 지정하지 않았을 때 기본값입니다.

```ts
ParticleSystem.create(emitter, {
	shape: ParticleSystem.Shape.Point(),
})
```

### 구

파티클은 구의 표면이나 내부에서 생성됩니다.

```ts
ParticleSystem.create(emitter, {
	shape: ParticleSystem.Shape.Sphere({ radius: 2 }),
})
```

### 원뿔

입자는 원뿔의 밑면에서 생성되어 원뿔이 향하는 방향으로 퍼져 나갑니다. `angle` 는 도 단위의 반각이고, `radius` 는 미터 단위의 밑면 반지름입니다. 원뿔의 방향을 설정하려면 엔티티의 `Transform`.

```ts
ParticleSystem.create(emitter, {
	shape: ParticleSystem.Shape.Cone({ angle: 25, radius: 1 }),
})
```

### 상자

입자는 상자형 볼륨 내부 어디서나 생성됩니다.

```ts
ParticleSystem.create(emitter, {
	shape: ParticleSystem.Shape.Box({ size: Vector3.create(3, 1, 3) }),
})
```

## 방출 속성

생성되는 입자 수와 입자의 수명을 제어합니다.

| 속성             | 기본값    | 설명                             |
| -------------- | ------ | ------------------------------ |
| `rate`         | `10`   | 초당 방출되는 입자 수(연속 방출).           |
| `maxParticles` | `1000` | 동시에 살아 있는 입자 수의 최대 한도입니다.      |
| `lifetime`     | `5`    | 각 입자의 수명(초)입니다.                |
| `active`       | `true` | 시스템이 새 파티클을 능동적으로 방출하는지 여부입니다. |

```ts
ParticleSystem.create(emitter, {
	rate: 50,
	maxParticles: 500,
	lifetime: 3,
})
```

## 움직임

### 중력

The `gravity` 속성은 장면의 중력(-9.81 m/s²)에 곱해 적용되는 값입니다. 다음과 같이 설정하면 `0` 입자가 제자리에 떠 있게 하려면 음수 값을, 위쪽으로 밀어 올리려면 음수 값을, 아래쪽으로 가속하려면 양수 값을 지정합니다.

```ts
ParticleSystem.create(emitter, {
	gravity: -0.5, // particles float slowly upward
})
```

### 초기 속도

`initialVelocitySpeed` 는 `FloatRange` 로, 각 입자가 방출될 때 적용되는 무작위 속도 범위의 최솟값과 최댓값(단위: m/s)을 설정합니다. 두 값의 기본값은 `1`.

```ts
ParticleSystem.create(emitter, {
	initialVelocitySpeed: { start: 2, end: 8 },
})
```

### 추가 힘

중력에 더해 매 프레임 모든 입자에 적용되는 일정한 힘 벡터입니다. 바람이나 자기 효과를 구현할 때 유용합니다.

```ts
ParticleSystem.create(emitter, {
	additionalForce: Vector3.create(0.5, 0, 0), // constant sideways push
})
```

### 속도 제한

다음을 사용하여 `limitVelocity` 입자의 최대 속도를 제한하고, 매 프레임 초과 속도를 감쇠할 수 있습니다.

```ts
ParticleSystem.create(emitter, {
	limitVelocity: {
		speed: 5, // maximum allowed speed in m/s
		dampen: 0.8, // fraction of excess velocity removed per frame
	},
})
```

## 시각적 속성

### 색상

`initialColor` 는 입자가 생성될 때의 색상을 설정하며, 지정한 범위 안에서 무작위로 선택됩니다. `colorOverTime` 는 입자의 수명 동안 색상을 점진적으로 `start` 값에서 `end` 값으로 전환합니다. 두 속성 모두 다음을 사용하는 `ColorRange` 이며, 여기에는 `start` 및 `end` 값이 있습니다.

```ts
import { Color4 } from '@dcl/sdk/math'

ParticleSystem.create(emitter, {
	initialColor: {
		start: Color4.create(1, 0.5, 0, 1), // orange
		end: Color4.create(1, 1, 0, 1), // yellow
	},
	colorOverTime: {
		start: Color4.create(0.5, 0, 0, 0.5), // dim red, half transparent
		end: Color4.create(0, 0, 0, 0), // fully transparent (fade out)
	},
})
```

Color4의 네 번째 값은 `Color4` 입니다. *알파*. 최종 색상의 알파를 0으로 설정하면 입자가 점차 페이드아웃되어 보이지 않게 됩니다. 이는 흔히 사용되는 효과입니다.

### 크기

`initialSize` 및 `sizeOverTime` 은 `FloatRange` 값입니다. `initialSize` 입자 생성 시 크기를 제어하며, 지정된 범위 내에서 무작위로 선택됩니다. `sizeOverTime` 입자의 크기가 점차 다음 값에서 `start` 다음 값으로 `end` 값으로 변하도록 합니다. 값이 `1` 이면 원래 텍스처 크기와 같습니다.

```ts
ParticleSystem.create(emitter, {
	initialSize: { start: 0.1, end: 0.3 },
	sizeOverTime: { start: 0.5, end: 1.0 }, // 수명 동안 커짐
})
```

{% hint style="warning" %}
**📔 참고**: 엔티티의  `scale`  속성은 해당 엔티티의  `Transform` 에 속하며 파티클의 크기에는 영향을 주지 않습니다.
{% endhint %}

### 텍스처

기본적으로 파티클은 흰색 사각형으로 렌더링됩니다. 사용자 지정 이미지를 사용하려면 텍스처를 지정하세요.

```ts
ParticleSystem.create(emitter, {
	texture: { src: 'assets/scene/Images/spark.png' },
})
```

### 블렌드 모드

입자 색상이 뒤쪽 장면과 합성되는 방식을 제어합니다.

| 값                                      | 설명                                           |
| -------------------------------------- | -------------------------------------------- |
| `ParticleSystemBlendMode.PSB_ALPHA`    | 표준 투명도(기본값)입니다.                              |
| `ParticleSystemBlendMode.PSB_ADD`      | 가산 혼합 — 입자가 장면을 더 밝게 만듭니다. 불과 빛나는 효과에 적합합니다. |
| `ParticleSystemBlendMode.PSB_MULTIPLY` | 입자 색상을 뒤쪽 장면의 색상과 곱합니다.                      |

```ts
import { ParticleSystemBlendMode } from '@dcl/sdk/ecs'

ParticleSystem.create(emitter, {
	texture: { src: 'assets/scene/textures/ember.png' },
	blendMode: ParticleSystemBlendMode.PSB_ADD,
})
```

### 빌보드

billboard가 `billboard` 이면 `true` (기본값), 각 파티클은 이미터의 방향과 관계없이 항상 카메라를 향합니다. 3D 공간에서 회전하며 움직여야 하는 파티클에는 `false` 로 설정하세요.

```ts
ParticleSystem.create(emitter, {
	billboard: false,
})
```

## 회전

### 초기 회전 및 시간에 따른 회전

`initialRotation` 은 파티클이 생성될 때의 방향입니다. `rotationOverTime` 은 매초 적용되는 축별 각속도입니다. 두 속성 모두 다음을 허용합니다. `Quaternion`.

```ts
import { Quaternion } from '@dcl/sdk/math'

ParticleSystem.create(emitter, {
	initialRotation: Quaternion.fromEulerDegrees(0, 0, 45),
	rotationOverTime: Quaternion.fromEulerDegrees(0, 0, 90), // Z축 기준 90°/s 회전
})
```

{% hint style="warning" %}
**📔 참고**:  `billboard` 를 `true`로 설정하면 파티클은 한 축으로만 회전하며 항상 카메라를 향합니다.
{% endhint %}

### 이동 방향 바라보기

속성 `faceTravelDirection` 이 `true`이면 각 파티클은 소행성이나 공중에서 떨어지는 나뭇잎처럼 이동 방향을 향하도록 자동으로 회전합니다.

```ts
ParticleSystem.create(emitter, {
	faceTravelDirection: true,
	billboard: false,
})
```

{% hint style="warning" %}
**📔 참고**:  `faceTravelDirection` 이 true이면 `billboard` 의 값은 무시됩니다.
{% endhint %}

## 스프라이트 시트 애니메이션

텍스처를 애니메이션 프레임의 격자로 사용하여 파티클을 애니메이션으로 만들 수 있습니다. 시트의 열과 행 수 및 재생 속도를 지정하세요.

```ts
ParticleSystem.create(emitter, {
	texture: { src: 'assets/scene/textures/flame-sheet.png' },
	spriteSheet: {
		tilesX: 4, // 4열
		tilesY: 3, // 3행  (총 12프레임)
		framesPerSecond: 12,
	},
})
```

## 재생 제어

파티클 시스템은 다음 속성으로 제어되는 세 가지 상태 중 하나일 수 있습니다: `playbackState`.

| 값                                        | 설명                             |
| ---------------------------------------- | ------------------------------ |
| `ParticleSystemPlaybackState.PS_PLAYING` | 파티클을 계속 방출합니다(기본값).            |
| `ParticleSystemPlaybackState.PS_PAUSED`  | 현재 파티클을 모두 제자리에 멈추고 방출을 중지합니다. |
| `ParticleSystemPlaybackState.PS_STOPPED` | 방출을 중지하고 기존 파티클을 모두 제거합니다.     |

```ts
import { ParticleSystemPlaybackState } from '@dcl/sdk/ecs'

// 플레이어가 멀어지면 일시 정지
ParticleSystem.getMutable(emitter).playbackState =
	ParticleSystemPlaybackState.PS_PAUSED

// 재개
ParticleSystem.getMutable(emitter).playbackState =
	ParticleSystemPlaybackState.PS_PLAYING
```

### 반복 및 사전 준비

기본적으로 시스템은 무한히 반복됩니다. 단발성 효과를 사용하려면 `loop` 를 `false` 로 설정하세요. 그러면 모든 파티클의 수명이 끝난 후 효과가 자동으로 중지됩니다.

다음 설정을 사용하세요: `prewarm` = `true` (다음이 필요합니다: `loop: true`) 시스템이 처음부터 실행된 것처럼 시뮬레이션하므로 플레이어가 처음 볼 때 이미 파티클이 장면을 가득 채우고 있습니다.

```ts
ParticleSystem.create(emitter, {
	loop: false, // 한 번 재생한 후 중지
	prewarm: false,
})
```

## 버스트 방출

버스트를 사용하면 일정한 속도로 방출하는 대신 특정 시점에 많은 수의 파티클을 방출할 수 있습니다. 폭발, 불꽃놀이 또는 기타 일회성 이벤트에 유용합니다.

단일 파티클 시스템에서 여러 버스트가 포함된 주기를 실행할 수 있으며, 간격이나 확률을 다르게 설정해 더욱 자연스럽게 연출할 수도 있습니다.

```ts
ParticleSystem.create(emitter, {
	rate: 0, // 연속 방출 비활성화
	bursts: {
		values: [
			{
				time: 0, // 재생 시작 후 경과 시간(초)
				count: 200, // 버스트당 방출할 파티클 수
				cycles: 1, // 반복 횟수(0 = 무한)
				interval: 0.2, // 반복 주기 사이의 간격(초)
				probability: 1, // 각 주기에서 버스트가 실행될 확률(0–1)
			},
		],
	},
})
```

간격을 둔 버스트가 있는 반복 불꽃놀이 효과를 만들려면 다음과 같이 설정합니다:

```ts
ParticleSystem.create(emitter, {
	loop: true,
	rate: 0,
	lifetime: 2,
	bursts: {
		values: [
			{ time: 0.0, count: 80, cycles: 0, interval: 3 },
			{ time: 0.7, count: 100, cycles: 0, interval: 3 },
			{ time: 1.4, count: 60, cycles: 0, interval: 3 },
		],
	},
})
```

## 시뮬레이션 공간

파티클이 이미터를 기준으로 움직일지((`PSS_LOCAL`, 기본값) 아니면 생성된 후 월드 좌표에 고정될지(`PSS_WORLD`).

다음의 경우 `PSS_WORLD` 를 사용하세요. 이동하는 이미터가 지나간 자리에 흔적을 남겨야 하는 경우입니다(예: 소행성이나 로켓).

```ts
import { PBParticleSystem_SimulationSpace } from '@dcl/sdk/ecs'

ParticleSystem.create(emitter, {
	simulationSpace: PBParticleSystem_SimulationSpace.PSS_WORLD,
})
```

## 성능

엔진은 장면별 파티클 예산을 적용하며, 장면 내 활성 파티클 시스템 전체의 파티클 수가 제한을 초과하면 모든 시스템의 방출 속도를 자동으로 낮춥니다. 이에 맞춰 장면을 설계하세요:

* 영향이 적은 시스템을 많이 사용하는 대신 시각적 효과가 큰 시스템을 적게 사용하세요.
* 다음을 사용해 `maxParticles` 개별 시스템의 상한을 설정하세요.
* 다음을 사용해 `active` 또는 `playbackState` 화면 밖에 있거나 범위를 벗어난 시스템을 비활성화하세요.
* 짧은 `lifetime` 값을 사용하면 방출 속도가 높아 보이는 경우에도 활성 파티클 수를 낮게 유지할 수 있습니다. `rate` 만으로 예상되는 것보다 낮게 유지됩니다.

엔진은 한 번에 렌더링되는 최대 파티클 수를 1000개로 제한합니다. 이보다 많은 파티클을 방출하면 모든 파티클이 보이지 않을 수 있습니다.

또한 플레이어가 장면 안에 있을 때만 파티클을 볼 수 있다는 점에 유의하세요. 장면 바깥에서 장면을 바라보는 플레이어는 안으로 들어오기 전까지 파티클을 볼 수 없습니다.

## 파티클 랩

월드에 입장해 [ParticleLab.dcl.eth](decentraland://?realm=particlelab.dcl.eth\&dclenv=org) 다양한 파티클 시스템을 실험해 보세요. 파티클 시스템에 가까이 다가가면 UI에 사용 가능한 필드가 모두 표시되며, 장면을 다시 불러오지 않고도 실시간으로 값을 조정할 수 있습니다. 원하는 설정이 되면 **복사** 버튼을 클릭해 해당 파티클 시스템의 코드를 클립보드에 복사하세요.

{% hint style="info" %}
**💡 팁**: 모든 `ParticleSystem` 필드를 사용하는 실제 예제는 [`0,7-particle-system`](https://github.com/decentraland/sdk7-test-scenes/tree/main/scenes/0,7-particle-system) 테스트 장면을 참조하세요. 이 장면에서는 네 가지 이미터 모양과 `PSB_ADD`/`PSB_ALPHA`/`PSB_MULTIPLY` 블렌드 모드, `PS_PLAYING`/`PS_PAUSED`/`PS_STOPPED` 재생 상태, 스프라이트 시트, 연속 `rate` 와 일회성 및 반복 `bursts`를 비교하고, 움직이는 이미터에서 `PSS_LOCAL` 과 `PSS_WORLD` 를 비교합니다.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.decentraland.org/creator/content-creator-ko/sdk7/3d/particle-system.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
