Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
Sign in to follow this  
rubengc

Wrong object rotation when I tilt my mobile in landscape orientation

Question

Hi

 

I'm trying to rotate an object with the same tilt as my mobile

 

I found this thread that is really helpful

 

Please login or register to see this link.

 

But, when I put the device in landscape orientation and try to tilt the mobile between left and right, the object rotate in Z and Y axis

 

I would like to lock Y axis when the mobile is in horizontal, but not when it's in vertical

 

I put an image about I'm trying:

PdGjepX.png

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I put the current code here:

Please login or register to see this code.

I'm continue searching a solution for this, Ii try somethings but anything work :(

Share this post


Link to post
Share on other sites

  • 0

I am not completely sure what you want, instead of "locking" why not just don't read that value? Here's a great post and image showing how axis behave :

Please login or register to see this link.

 

I am not sure does the axis stay the same or change if orientation changes, but this could be the case.

Please login or register to see this link.

Share this post


Link to post
Share on other sites
  • 0

Thanks for reply young developer

 

If you try my code over a plane, you will see my problem quickly

 

All rotations works perfectly, but when in put the mobile horizontally (my mobile is always in landscape orientation, i refer to tilt the mobile 90 degrees, so completly parallel to the floor) and start to tilt between left and right, the objects start to rotate in their X and Y axis

 

I need the Y axis rotation in vertical, but not in horizontal, so in need to limit this rotation when the mobile is completly horizontal

 

I will continue testing

Share this post


Link to post
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.

Guest
Answer this question...

×   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.

Sign in to follow this  

×
×
  • Create New...