- Home /
Question by
danmangar13 · Apr 29, 2020 at 11:17 AM ·
rotationlimit
I want to restrict the rotation with the following Script,I want to restrict tranform.Rotation
I cant restrict the rotation and I eant to continue the following scrpit:
using System.Collections; using System.Collections.Generic; using System.Collections.Specialized; using System.Security.Cryptography; using UnityEngine;
public class RotY : MonoBehaviour { float Max = 300; float Min = -300; float rotSpeed = 200f;
void OnMouseDrag()
{
float rotY = Input.GetAxis("Mouse Y") * rotSpeed * Mathf.Deg2Rad;
transform.Rotate(Vector3.up, rotY);
}
}
Comment