2026-03-21 15:55:04 +08:00
|
|
|
# Transform::Space
|
|
|
|
|
|
|
|
|
|
**命名空间**: `XCEngine::Math`
|
|
|
|
|
|
|
|
|
|
**类型**: `enum class`
|
|
|
|
|
|
2026-03-26 02:41:00 +08:00
|
|
|
**头文件**: `XCEngine/Core/Math/Transform.h`
|
2026-03-21 15:55:04 +08:00
|
|
|
|
|
|
|
|
## 概述
|
|
|
|
|
|
|
|
|
|
`Space` 枚举用于指定变换操作的参考空间。
|
|
|
|
|
|
|
|
|
|
## 枚举值
|
|
|
|
|
|
|
|
|
|
| 枚举值 | 数值 | 描述 |
|
|
|
|
|
|--------|------|------|
|
|
|
|
|
| `Self` | `0` | 相对于自身空间进行变换 |
|
|
|
|
|
| `World` | `1` | 相对于世界空间进行变换 |
|
|
|
|
|
|
|
|
|
|
## 使用示例
|
|
|
|
|
|
|
|
|
|
```cpp
|
2026-03-26 02:41:00 +08:00
|
|
|
#include "XCEngine/Core/Math/Transform.h"
|
|
|
|
|
#include "XCEngine/Core/Math/Vector3.h"
|
2026-03-21 15:55:04 +08:00
|
|
|
|
|
|
|
|
using namespace XCEngine::Math;
|
|
|
|
|
|
|
|
|
|
Transform transform;
|
|
|
|
|
transform.position = Vector3(10.0f, 0.0f, 0.0f);
|
|
|
|
|
|
|
|
|
|
// 在自身空间旋转
|
|
|
|
|
// transform.Rotate(Vector3::Up(), 45.0f * DEG_TO_RAD, Space::Self);
|
|
|
|
|
|
|
|
|
|
// 在世界空间旋转
|
|
|
|
|
// transform.Rotate(Vector3::Up(), 45.0f * DEG_TO_RAD, Space::World);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## 相关文档
|
|
|
|
|
|
|
|
|
|
- [Transform 总览](transform.md) - Transform 类总览
|