refactor: TransformComponent 旋转存储改四元数(UE FTransform 语义)
欧拉角内部存储每帧矩阵↔欧拉往返,是 Gizmo 拖拽乱跳/缩放串轴的 结构性根源(74d2f6c 的单点公式修复治标不治本)。对齐 UE/Unity 方案:内部存 glm::quat,欧拉只在 UI 表皮。 - Components.h:m_Rotation 改 quat;Compose 用 mat4_cast; SetRotation(euler) 转存(q=qy·qx·qz);新增 SetRotationQuat/ GetRotationQuat;GetRotation() 改派生欧拉(YXZ 序矩阵反解, 仅 UI 显示/编辑用) - ViewportPanel:Gizmo 写回 decompose 的 quat 直写,删除整个 欧拉提取块 - PhysicsWorld:删 QuatToEulerYXZ/EulerYXZToQuat,改 ToJolt/ ToGlm 分量直转;物理写回 SetRotationQuat;BodyRecord.lastRot 改存 quat 验证(1 万随机姿态 round-trip):Gizmo 链路矩阵差 7.9e-07 (旧欧拉方案 3.56e-04,好 3 个数量级);万向锁 pitch=±90° 穿 表皮恒定;欧拉表皮误差 4.5e-04 为欧拉参数化固有病态(随 pitch→±90 指数增长,仅影响 UI 显示数值),热路径不经过。
This commit is contained in:
+2
-1
@@ -26,7 +26,8 @@
|
||||
#include <Engine/Renderer/Renderer.h>
|
||||
#include <Engine/Renderer/Model.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user