Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class TurretControls : MonoBehaviour {
- public Transform turret;
- public Transform weapon;
- public Transform cameraCenter;
- public LayerMask layersAllowed;
- public float rangeOfRay;
- private RaycastHit target;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- //Ray cameraRay = new Ray(cameraCenter.position, cameraCenter.forward);
- //if (Physics.Raycast(cameraRay, out target, rangeOfRay, layersAllowed.value)){
- //turret.LookAt(target.point);
- if (Input.GetKey("v")){
- turret.transform.Rotate(Vector3.up, 100 * Time.deltaTime );
- }
- if (Input.GetKey("b")){
- turret.transform.Rotate( Vector3.up, -100* Time.deltaTime );
- }
- }
- }
Add Comment
Please, Sign In to add comment