> 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, Quaternion 등을 포함해 어떤 특수 유형이 있는지 알아봅니다.

## Vector3

Decentraland는 사용합니다 *vector3* 경로, 공간의 점, 방향을 표현하기 위한 데이터입니다. 벡터는 회전 방향을 정의하는 데에도 사용할 수 있으며, 더 친숙한 대안입니다 *쿼터니언*. Vector3 객체에는 각 구성 요소에 대한 수치 값이 포함됩니다 *x*, *y*, 그리고 *z* 축입니다.

```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*, *z*, *w*.

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

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

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

아래에는 Quaternion의 몇 가지 기본 연산에 대한 구문을 보여 주는 몇 줄이 있습니다.

```ts
// quaternion 객체 만들기
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에는 Quaternion과 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 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/special-types.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.
