UnityMol  0.9.6-875
UnityMol viewer / In developement
CameraFacingBillboard.cs
Go to the documentation of this file.
1 
66 using UnityEngine;
67 
68  using System.Collections;
69 
70 
71 
72  public class CameraFacingBillboard : MonoBehaviour
73 
74  {
75 
76  public Camera cameraToLookAt;
77 
78 
79 
80 void Start()
81 
82  {
83 
84  cameraToLookAt = Camera.main;
85 
86  }
87 
88 
89 
90  void Update()
91 
92  {
93 
94  Vector3 v = cameraToLookAt.transform.position - transform.position;
95 
96  v.x = v.y = v.z = 0.0f;
97 
98  transform.LookAt(cameraToLookAt.transform.position - v);
99 
100  }
101 
102  }
103