Guest User

Untitled

a guest
Mar 13th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.86 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class TurretControls : MonoBehaviour {
  5.  
  6.     public Transform turret;
  7.     public Transform weapon;
  8.     public Transform cameraCenter;
  9.     public LayerMask layersAllowed;
  10.     public float rangeOfRay;
  11.    
  12.     private RaycastHit target;
  13.    
  14.    
  15.    
  16.     // Use this for initialization
  17.     void Start () {
  18.    
  19.     }
  20.    
  21.     // Update is called once per frame
  22.     void Update () {
  23.      //Ray cameraRay = new Ray(cameraCenter.position, cameraCenter.forward);
  24.         //if (Physics.Raycast(cameraRay, out target, rangeOfRay, layersAllowed.value)){
  25.             //turret.LookAt(target.point);
  26.         if (Input.GetKey("v")){
  27.                 turret.transform.Rotate(Vector3.up, 100 * Time.deltaTime );
  28.         }      
  29.        
  30.         if (Input.GetKey("b")){
  31.                 turret.transform.Rotate( Vector3.up, -100* Time.deltaTime );
  32.         }
  33.            
  34.        
  35.         }
  36.    
  37.    
  38.  
  39.        
  40.    
  41.     }
Add Comment
Please, Sign In to add comment