Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

Vertical plane object always is rotated in y-axis #378

Closed
dxbup opened this issue Sep 6, 2018 · 3 comments
Closed

Vertical plane object always is rotated in y-axis #378

dxbup opened this issue Sep 6, 2018 · 3 comments

Comments

@dxbup
Copy link

dxbup commented Sep 6, 2018

Is this possible to set object on vertical plane with rotation pararell to horizontal plane? For example image frame or tv screen - I would like to place it wall-sticky but I get random rotation in y-axis.

@pablisho
Copy link
Contributor

pablisho commented Sep 6, 2018

Hi, the plane orientation itself will depend of the shape of the detected plane, but if you want to place an object on it, you can adjust its orientation to always be aligned with Y axis.
For example in HelloAR, when we place an Andy model, it's always looking at the camera:
https://github.com/google-ar/arcore-unity-sdk/blob/master/Assets/GoogleARCore/Examples/HelloAR/Scripts/HelloARController.cs#L136. It's not the same transformation, but I think you can do something similar to have your object aligned with Y. Let me know if this helps.

@dxbup
Copy link
Author

dxbup commented Sep 7, 2018

I have used that trick before, but it made it depending on phone position and rotation. It would be great if user had been using stationary tripod, but it is not a solution.

@fredsa
Copy link
Member

fredsa commented Sep 21, 2018

You can use Transform.LookAt():
https://docs.unity3d.com/ScriptReference/Transform.LookAt.html

Make sure to use the two argument version of this method.

@fredsa fredsa closed this as completed Sep 21, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants