docs: 重构 API 文档 - components 和 scene 模块
- components: 修复英文标题为中文,添加缺失组件文档 - 新增 camera-component, light-component, audio-source-component, audio-listener-component 类总览 - 修复 get-position.md 格式 - 更新 components.md 模块总览 - scene: 修复方法文档格式,新增缺失方法 - 修复 find.md, create-game-object.md 英文标题 - 新增 FindByID, SerializeToString, DeserializeFromString 方法文档 - 更新 scene.md 类总览方法列表
This commit is contained in:
@@ -1,33 +1,34 @@
|
||||
# GetPosition
|
||||
# TransformComponent::GetPosition
|
||||
|
||||
Get the world position of this transform.
|
||||
|
||||
## Syntax
|
||||
获取变换的世界空间位置。
|
||||
|
||||
```cpp
|
||||
Math::Vector3 GetPosition() const;
|
||||
```
|
||||
|
||||
## Returns
|
||||
返回变换的世界空间位置。如果变换有父对象,世界位置由局部位置与父对象世界位置组合计算得出。
|
||||
|
||||
Returns the world position as a `Math::Vector3`.
|
||||
**返回:** `Math::Vector3` - 世界空间位置向量
|
||||
|
||||
## Remarks
|
||||
**线程安全:** ✅ (只读操作)
|
||||
|
||||
Returns the world-space position of this transform. If this transform has a parent, the world position is computed by combining the local position with the parent's world position.
|
||||
|
||||
## See Also
|
||||
|
||||
- [GetLocalPosition](get-local-position)
|
||||
- [SetLocalPosition](set-local-position)
|
||||
- [SetPosition](set-position)
|
||||
|
||||
## Examples
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Components/TransformComponent.h>
|
||||
|
||||
using namespace XCEngine::Components;
|
||||
|
||||
void Example(TransformComponent* transform) {
|
||||
Math::Vector3 worldPos = transform->GetPosition();
|
||||
XC_LOG_INFO("World position: ({}, {}, {})",
|
||||
printf("World position: (%f, %f, %f)\n",
|
||||
worldPos.x, worldPos.y, worldPos.z);
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [TransformComponent 总览](transform-component.md) - 返回类总览
|
||||
- [GetLocalPosition](get-local-position.md) - 获取局部位置
|
||||
- [SetPosition](set-position.md) - 设置世界位置
|
||||
- [SetLocalPosition](set-local-position.md) - 设置局部位置
|
||||
|
||||
Reference in New Issue
Block a user