MackeyK24

Switch Camera To Quaternion Rotation

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.