Log in or register to post comments

Change model material dependent on AR Camera angle

September 19, 2018 - 7:18am #1

Hello, I have something specific I really want to achieve using Unity for Android:

 

I would like to change the material of my model as the viewer physically moves around the image target. 

Specifically, I have 6 materials so I would like the material to change as the camera moves 60 degrees around the image target.

If anyone can help me do this I would be super appreciative. I am new to coding so any specific scripting would be really helpful.

 

Thank you very much in advance.

Change model material dependent on AR Camera angle

September 19, 2018 - 9:51am #2

Very possible.  Here's how I might handle.  Create an empty gameobject and parent it to the object center.  Then attach a script to the gameobject using something like LookRotation: https://docs.unity3d.com/ScriptReference/Quaternion.LookRotation.html  with the target being the camera transform.  Then read the rotation of this gameobject and change the materials of the AR object based on empty gameobject's rotation.  

 

Log in or register to post comments