Advertisement
Guest User

HPbartocamera

a guest
Feb 29th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.48 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class HpBarToCamera : MonoBehaviour
  6. {
  7.  
  8.     public Camera myCamera;
  9.  
  10.     // Start is called before the first frame update
  11.     void Start()
  12.     {
  13.         myCamera = Camera.main;
  14.     }
  15.  
  16.     // Update is called once per frame
  17.     void Update()
  18.     {
  19.         transform.LookAt(transform.position + myCamera.transform.rotation * Vector3.back, myCamera.transform.rotation * Vector3.up);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement