From 5ebb8c066d92356003eb59d621a41a5a47c6f83c Mon Sep 17 00:00:00 2001 From: luzhuang <364439895@qq.com> Date: Thu, 19 Dec 2024 11:39:48 +0800 Subject: [PATCH] fix: rotation error (#318) --- packages/auxiliary-lines/src/WireframeManager.ts | 6 +++--- packages/navigation-gizmo/src/SphereScript.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/auxiliary-lines/src/WireframeManager.ts b/packages/auxiliary-lines/src/WireframeManager.ts index 6393c6dc..d013aa16 100644 --- a/packages/auxiliary-lines/src/WireframeManager.ts +++ b/packages/auxiliary-lines/src/WireframeManager.ts @@ -350,7 +350,7 @@ export class WireframeManager extends Script { indices, this._indicesCount ); - Quaternion.rotationYawPitchRoll(rotation.x, rotation.y, rotation.z, tempRotation); + Quaternion.rotationYawPitchRoll(rotation.y, rotation.x, rotation.z, tempRotation); this._localRotation(positionsOffset, tempRotation); Vector3.multiply(position, worldScale, tempVector); this._localTranslate(positionsOffset, tempVector); @@ -382,7 +382,7 @@ export class WireframeManager extends Script { indices, this._indicesCount ); - Quaternion.rotationYawPitchRoll(rotation.x, rotation.y, rotation.z, tempRotation); + Quaternion.rotationYawPitchRoll(rotation.y, rotation.x, rotation.z, tempRotation); this._localRotation(positionsOffset, tempRotation); Vector3.multiply(position, worldScale, tempVector); this._localTranslate(positionsOffset, tempVector); @@ -431,7 +431,7 @@ export class WireframeManager extends Script { case ColliderShapeUpAxis.Z: tempAxis.set(halfSqrt, 0, 0, halfSqrt); } - Quaternion.rotationYawPitchRoll(rotation.x, rotation.y, rotation.z, tempRotation); + Quaternion.rotationYawPitchRoll(rotation.y, rotation.x, rotation.z, tempRotation); Quaternion.multiply(tempRotation, tempAxis, tempRotation); this._localRotation(positionsOffset, tempRotation); Vector3.multiply(position, worldScale, tempVector); diff --git a/packages/navigation-gizmo/src/SphereScript.ts b/packages/navigation-gizmo/src/SphereScript.ts index 643626f9..c5344097 100644 --- a/packages/navigation-gizmo/src/SphereScript.ts +++ b/packages/navigation-gizmo/src/SphereScript.ts @@ -193,7 +193,7 @@ export class SphereScript extends Script { const { _tempQuat: tempQuat, _tempQuat2: tempQuat2 } = this; Quaternion.rotationAxisAngle(SphereScript._startAxis, y, tempQuat); - Quaternion.rotationYawPitchRoll(x, 0, 0, tempQuat2); + Quaternion.rotationYawPitchRoll(0, x, 0, tempQuat2); Quaternion.multiply(tempQuat, tempQuat2, tempQuat); Vector3.subtract(SphereScript._startPos, this._target, this._rotateVec);