Advertisement
Guest User

Untitled

a guest
Oct 31st, 2017
89
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class TurretRotationScript : MonoBehaviour {
  6.  
  7.     public float horizontalSpeed = 2.0F;
  8.     public GameObject Player;
  9.     public GameObject Turret;
  10.  
  11.     void Update () {
  12.         float camh = horizontalSpeed * Input.GetAxis("Mouse X");
  13.         transform.Rotate(0, camh, 0);
  14.         transform.position = new Vector3(Player.transform.position.x, Turret.transform.position.y, Player.transform.position.z);
  15.     }
  16. }
Advertisement
RAW Paste Data Copied
Advertisement