> 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/special-types.md).

# 특수 유형

Vector, Quaternions 등 어떤 특수 유형이 있는지 알아보세요.

## Vector3

Decentraland는 사용합니다 *vector3* 데이터를 사용하여 경로, 공간의 점, 그리고 방향을 나타냅니다. 벡터는 회전 방향을 정의하는 데도 사용할 수 있으며, 보다 친숙한 대안으로 *쿼터니언*. Vector3 객체는 각 *x*, *y*, 그리고 *부터* 축입니다.

```ts
const myVector: Vector3 = { x: 8, y: 1, z: 8 }
```

그 `Vector3` 네임스페이스에는 대부분의 벡터 수학 연산을 직접 다루지 않아도 되도록 호출할 수 있는 유용한 메서드가 여러 개 들어 있습니다. 다음과 같이 입력하세요 `Vector3.`, 그러면 VS Studio에 사용 가능한 모든 함수가 들어 있는 드롭다운이 표시됩니다.

아래는 벡터의 몇 가지 기본 연산에 대한 문법을 보여 주는 몇 줄입니다.

```ts
// 벡터 객체를 만듭니다
let myVector = Vector3.create(3, 1, 5)

// 벡터 객체를 만드는 대체 문법
let myOtherVector: Vector3 = { x: 8, y: 1, z: 8 }

// 값 중 하나를 편집합니다
myVector.x = 5

// Vector3 네임스페이스의 함수를 호출합니다,
// 이 함수들은 모두 매개변수에 Vector3 객체를 전달해야 합니다

let normalizedVector = Vector3.normalize(myVector)

let distance = Vector3.distance(myVector, myOtherVector)

let midPoint = Vector3.lerp(myVector, myOtherVector, 0.5)
```

Vector3 객체는 여러 컴포넌트의 필드에서 자주 필요합니다. 예를 들어, `Transform` 컴포넌트에는 `Vector3` 에 대한 값이 *위치* 및 *크기* 엔터티의

다음을 만들려면 [사용자 지정 컴포넌트](/creator/content-creator-ko/sdk7/architecture/custom-components.md) Vector3 값이 필요한 매개변수가 있는 `Schemas.Vector3`.

{% hint style="warning" %}
**📔 참고**: `Vector3` 는 다음을 통해 가져와야 합니다

> `import { Vector3 } from "@dcl/sdk/math"`

참고 [가져오기](/creator/content-creator-ko/sdk7/getting-started/coding-scenes.md#imports) 를 사용하면 이를 쉽게 처리할 수 있습니다.
{% endhint %}

### 방향 벡터를 작성하는 단축 표기

일반적인 벡터를 정의할 때 다음 단축 표기를 사용할 수 있습니다:

* `Vector3.Zero()` 를 반환합니다. *(0, 0, 0)*
* `Vector3.Up()` 를 반환합니다. *(0, 1, 0)*
* `Vector3.Down()` 를 반환합니다. *(0, -1, 0)*
* `Vector3.Left()` 를 반환합니다. *(-1, 0, 0)*
* `Vector3.Right()` 를 반환합니다. *(1, 0, 0)*
* `Vector3.Forward()` 를 반환합니다. *(0, 0, 1)*
* `Vector3.Backward()` 를 반환합니다. *(0, 0, -1)*

## 쿼터니언

쿼터니언은 Transform 컴포넌트의 회전 정보를 저장하는 데 사용됩니다. Quaternion은 -1과 1 사이의 네 개 숫자 값으로 구성됩니다: *x*, *y*, *부터*, *w*.

```ts
const myQuaternion: Quaternion = { x: 0, y: 0, z: 0, w: 1 }
```

쿼터니언은 [*오일러* 각](https://en.wikipedia.org/wiki/Euler_angles), 더 일반적인 *x*, *y* 및 *부터* 대부분의 사람들이 익숙한 0에서 360까지의 숫자로 표현하는 표기법과 다릅니다. 엔진은 모든 회전을 쿼터니언으로 표현하므로, 가능한 한 Euler와의 변환 계산을 피하는 것이 좋습니다.

그 `Quaternion` 네임스페이스에는 많은 수학 연산을 직접 다루지 않아도 되도록 호출할 수 있는 유용한 메서드가 여러 개 들어 있습니다. 다음과 같이 입력하세요 `Quaternion.`, 그러면 VS Studio에 사용 가능한 모든 함수가 들어 있는 드롭다운이 표시됩니다.

아래는 쿼터니언의 몇 가지 기본 연산에 대한 문법을 보여 주는 몇 줄입니다.

```ts
// 쿼터니언 객체를 만듭니다
let myQuaternion = Quaternion.create(0, 0, 0, 1)

// 값 중 하나를 편집합니다
myQuaternion.x = 1

// quaternion 네임스페이스의 함수를 호출합니다
let midPoint = Quaternion.slerp(myQuaternion1, myQuaternion2, 0.5)

// 한 방향을 향하는 상태에서 다른 방향으로 회전할 때 필요한 회전을 가져오려면,
// 두 방향 Vector3 값을 전달합니다
let rotation = Quaternion.fromToRotation(Vector3.Forward(), Vector3.Up())
```

Euler 각도로 생각하는 것이 훨씬 쉽기 때문에, SDK에는 Quaternions와 Euler 간 변환을 위한 몇 가지 함수가 포함되어 있습니다.

{% hint style="info" %}
**💡 팁**: 시스템 내부의 반복 로직, 즉 모든 틱마다 실행되는 로직의 일부로 이러한 변환을 실행하지 마세요. 비용이 많이 들 수 있습니다. 이러한 변환은 새 엔터티의 회전을 설정하는 것과 같은 일회성 작업에 주로 유용합니다.
{% endhint %}

```ts
// Euler에서 Quaternion으로
let myQuaternion = Quaternion.fromEulerDegrees(90, 0, 0)

// Quaternion에서 Euler로
let myEuler = Quaternion.toEulerAngles(myQuaternion)
```

Quaternion 객체는 컴포넌트의 필드에서 자주 필요합니다. 예를 들어, `Transform` 컴포넌트에는 `Quaternion` 엔터티의 회전에 대한 값이

다음을 만들려면 [사용자 지정 컴포넌트](/creator/content-creator-ko/sdk7/architecture/custom-components.md) Quaternion 값이 필요한 매개변수가 있는 `Schemas.Quaternion`.

{% hint style="warning" %}
**📔 참고**: `Quaternion` 는 다음을 통해 가져와야 합니다

> `import { Quaternion } from "@dcl/sdk/math"`

참고 [가져오기](/creator/content-creator-ko/sdk7/getting-started/coding-scenes.md#imports) 를 사용하면 이를 쉽게 처리할 수 있습니다.
{% endhint %}

## 스칼라

스칼라는 그저 숫자일 뿐입니다. 따라서 다음과 같은 객체를 인스턴스화하는 것은 크게 의미가 없습니다. `Scalar` 데이터를 저장하기 위한 객체는 숫자로도 같은 작업을 할 수 있으므로, 데이터를 저장하는 객체를 만들 필요가 없습니다. 그러나 `Scalar` 네임스페이스에는 그러나 (다음의 것들과 비슷한) 여러 유용한 함수가 노출되어 있습니다 *Vector3* 네임스페이스), 숫자에 사용할 수 있는 함수들입니다.

```ts
// Scalar 클래스의 함수를 호출합니다
let random = Scalar.randomRange(1, 100)

let midPoint = Scalar.lerp(number1, number2, 0.5)

let clampedValue = Scalar.clamp(myInput, 0, 100)
```

{% hint style="warning" %}
**📔 참고**: `Scalar` 는 다음을 통해 가져와야 합니다

> `import { Scalar } from "@dcl/sdk/math"`

참고 [가져오기](/creator/content-creator-ko/sdk7/getting-started/coding-scenes.md#imports) 를 사용하면 이를 쉽게 처리할 수 있습니다.
{% 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
