Advertisement
Guest User

RotationController

a guest
Jan 20th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class RotationController : MonoBehaviour {
  6.  
  7.     public float rotationSpeed;
  8.     public Transform tower;
  9.  
  10.     Vector3 currentRotation;
  11.  
  12.     void Start () {
  13.         currentRotation = tower.transform.eulerAngles;
  14.     }
  15.    
  16.     void Update () {
  17.         currentRotation.y += Input.GetAxis("Mouse X") * rotationSpeed * Time.deltaTime;
  18.         tower.transform.eulerAngles = currentRotation;
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement