lostwoods91 Posted October 4, 2016 Share Posted October 4, 2016 Hi everyone. i would like to edit the TargetCamera in order to add the functionality to rotate around his own axis instead of world axis, like it actually do. i thought to edit its _checkInputs method this way: //this.rotation.x += this.cameraRotation.x; //this.rotation.y += this.cameraRotation.y; var orientationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(this.rotation.y, this.rotation.x, this.rotation.z); var rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(this.cameraRotation.y, this.cameraRotation.x, 0); orientationQuaternion.multiplyToRef(rotationQuaternion, orientationQuaternion); this.rotation = orientationQuaternion.toEulerAngles(); so it could accumulate to his own rotation vector the rotation given by cameraRotation. the effect i'm aiming to is similar to LOCAL / WORLD rotations for meshes (rotate() method). but something is wrong... am i making a mistake with rotation math, or what? thanks everyone! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 4, 2016 Share Posted October 4, 2016 Hello! As usual it's easier for us to help with a Playground repro Quote Link to comment Share on other sites More sharing options...
lostwoods91 Posted October 4, 2016 Author Share Posted October 4, 2016 You're right, tomorrow I'll set up a little demo. Thank you Quote Link to comment Share on other sites More sharing options...
lostwoods91 Posted October 5, 2016 Author Share Posted October 5, 2016 http://playground.babylonjs.com/#1L73UE#0 this is it EDIT: i studied the case, i was totally wrong! rotation is local already. sorry for the inconvenient! anyway, there is still the fact that camera rotation should be dependant to the camera's upVector parameter. GameMonetize 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.