Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class BillboardYAxis : MonoBehaviour {
- private Camera camToLookAt;
- //============================================
- void Awake()
- {
- if (Camera.main != null)
- camToLookAt = Camera.main;
- }
- //============================================
- void Update()
- {
- if (Camera.main != null)
- {
- Vector3 v = camToLookAt.transform.position - transform.position;
- v.x = 0.0f;
- v.z = 0.0f;
- transform.LookAt(camToLookAt.transform.position - v);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement