This commit is contained in:
2026-05-13 11:28:49 +08:00
parent 223fa5dd4e
commit 21255a701d
12 changed files with 1765 additions and 537 deletions

23
test-rotation.js Normal file
View File

@ -0,0 +1,23 @@
// 测试不同的旋转方案
// 方案1只旋转Y轴当前方案
plane.rotation.y = angle;
// 方案2先X轴90度再Y轴
plane.rotation.x = Math.PI / 2;
plane.rotation.y = angle;
// 方案3使用lookAt
plane.lookAt(center.add(normal));
// 方案4使用四元数旋转
const forward = new Vector3(0, 0, -1); // 平面默认法线
const targetNormal = normal.normalize();
const quaternion = Quaternion.FromUnitVectorsToRef(forward, targetNormal, new Quaternion());
plane.rotationQuaternion = quaternion;
// 方案5手动设置旋转根据墙面方向
// 前墙 (Z负方向): rotation.y = 0
// 后墙 (Z正方向): rotation.y = Math.PI
// 左墙 (X负方向): rotation.y = Math.PI / 2
// 右墙 (X正方向): rotation.y = -Math.PI / 2