- 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 类总览方法列表
941 B
941 B
TransformComponent::GetPosition
获取变换的世界空间位置。
Math::Vector3 GetPosition() const;
返回变换的世界空间位置。如果变换有父对象,世界位置由局部位置与父对象世界位置组合计算得出。
返回: Math::Vector3 - 世界空间位置向量
线程安全: ✅ (只读操作)
示例:
#include <XCEngine/Components/TransformComponent.h>
using namespace XCEngine::Components;
void Example(TransformComponent* transform) {
Math::Vector3 worldPos = transform->GetPosition();
printf("World position: (%f, %f, %f)\n",
worldPos.x, worldPos.y, worldPos.z);
}
相关文档
- TransformComponent 总览 - 返回类总览
- GetLocalPosition - 获取局部位置
- SetPosition - 设置世界位置
- SetLocalPosition - 设置局部位置