2x4b Posted November 15, 2017 Share Posted November 15, 2017 Using camera.resetToCurrentRotation() I am able to set my camera to point to z+. I really need to set the camera rotation on the y axis to face z- or x+ or x- as well. Unfortunately I have been blundering about with quaternions for 2 days, and I can't seem to make it do what I want. Or it will do what I want, but only when the device is pointing a specific direction(very odd). Quote Link to comment Share on other sites More sharing options...
2x4b Posted November 15, 2017 Author Share Posted November 15, 2017 I gave up on Quaternions. Solved my problem with Euler instead. cam._initialQuaternion.x = 0; cam._initialQuaternion.z = 0; cam._initialQuaternion.y *= -1; cam._initialQuaternion.normalize(); var rot = cam._initialQuaternion.toEulerAngles() rot.y += Number(180).toRadians(); BABYLON.Quaternion.RotationYawPitchRollToRef(rot.y,rot.x,rot.z, cam._initialQuaternion); cam._initialQuaternion.normalize(); // Apply to camera cam._initialQuaternion.multiplyToRef(cam.rotationQuaternion, cam.rotationQuaternion); Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2017 Share Posted November 15, 2017 There is always a way 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.