Untitled
unknown
plain_text
4 years ago
733 B
11
Indexable
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Rotate2 : MonoBehaviour
{
public Transform Turret;
public float TowerSpeed;
public float TowerAngle;
void Start()
{
TowerAngle = 0;
Turret.localRotation = Quaternion.AngleAxis(TowerAngle, Vector3.right);
}
// Update is called once per frame
void Update()
{
rotatetower();
}
void rotatetower()
{
TowerAngle += Input.GetAxis("Mouse Y") * TowerSpeed * Time.deltaTime;
TowerAngle = Mathf.Clamp(TowerAngle, 0, 15);
Turret.localRotation = Quaternion.AngleAxis(TowerAngle, Vector3.right);
}
}Editor is loading...