MackeyK24 Posted September 12, 2017 Share Posted September 12, 2017 How to go about switch to quaternion rotation and keep the camera facing exact same position: I tried this: this.camera.rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(this.camera.rotation.x, this.camera.rotation.y, this.camera.rotation.z); But the camera is looking down and NOT the same position it was Quote Link to comment Share on other sites More sharing options...
adam Posted September 12, 2017 Share Posted September 12, 2017 Yaw = y rotation Pitch = x rotation Roll = z rotation RaananW 1 Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted September 12, 2017 Author Share Posted September 12, 2017 Yo Thanks @adam as always Heck.. man that fixed a lot of quaternion issues I was having with my Euler Functions... I didn't even notice I was transposing the Y and X ... /** Returns a new Quaternion set from the passed Euler float angles (y, x, z). */ public euler(eulerX:number, eulerY:number, eulerZ:number) : BABYLON.Quaternion { return BABYLON.Quaternion.RotationYawPitchRoll(eulerY, eulerX, eulerZ); } public eulerToRef(eulerX:number, eulerY:number, eulerZ:number, result:BABYLON.Quaternion):void { BABYLON.Quaternion.RotationYawPitchRollToRef(eulerY, eulerX, eulerZ, result); } /** Returns a new Matrix as a rotation matrix from the Euler angles (y, x, z). */ public matrix(eulerX:number, eulerY:number, eulerZ:number) : BABYLON.Matrix { return BABYLON.Matrix.RotationYawPitchRoll(eulerY, eulerX, eulerZ); } public matrixToRef(eulerX:number, eulerY:number, eulerZ:number, result:BABYLON.Matrix): void { BABYLON.Matrix.RotationYawPitchRollToRef(eulerY, eulerX, eulerZ, result); } I fixed them everything working now... Thanks adam 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.