Jump to content

DeviceOrientationCamera initial rotation


onurhanaytac
 Share

Recommended Posts

Hello everyone,

I want to set my DeviceOrientationCamera initial rotation. I dig forum and found something about resetToCurrentRotation() but im not able to make it work. I want my DeviceOrientationCamera start with looking a target like ArcRotateCam What i mean by this I place my cam to right place but it look to wrong direction for initial position.

 

cam = new babylon.DeviceOrientationCamera("DeviceOrientationCamera", position, scene);
cam.rotationQuaternion.y = Math.PI / 2;
cam.resetToCurrentRotation();

 

For example i want to turn my DeviceOrientationCamera X degree in Y axis then start controlling with device. What should i do?

Thanks in advence!

Link to comment
Share on other sites

Thanks for the answer @Deltakosh 

self.cam.rotationQuaternion = babylon.Quaternion.FromRotationMatrix(babylon.Matrix.RotationY(self.toRadians(self.compassDegree)));

I did fix the angle. My scene know shows up correctly but after a second cam turns the same position i think i am not able to reset the rotationQuaternion

https://www.babylonjs-playground.com/#8FFPCG#4 here is a code similar to what im doing.

when i open this with my phone i need to turn the device X degree to see the scene. But just for a sec in the beginning it is rotate the cam i think I cannot reset the cam at that moment.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...