Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class TurretRotationScript : MonoBehaviour {
- public float horizontalSpeed = 2.0F;
- public GameObject Player;
- public GameObject Turret;
- void Update () {
- float camh = horizontalSpeed * Input.GetAxis("Mouse X");
- transform.Rotate(0, camh, 0);
- transform.position = new Vector3(Player.transform.position.x, Turret.transform.position.y, Player.transform.position.z);
- }
- }
Advertisement
RAW Paste Data
Copied
Advertisement