1
This commit is contained in:
23
test-rotation.js
Normal file
23
test-rotation.js
Normal 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
|
||||
Reference in New Issue
Block a user