Hello Guys,
i know this questions gets asked a lot but i got this small c# script working so far but there is a stuttering when i want to clamp it in the negative rotation. I usually work with playmaker but want to force me scripting things that cant be done correctly or like this with so few lines of code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Gun_Lockrotation : MonoBehaviour {
public float MaxDepression = -5f;
public float MaxElevation = 20f;
void LateUpdate()
{
transform.localEulerAngles = new Vector3 (Mathf.Clamp(transform.localEulerAngles.x, MaxDepression, MaxElevation), transform.localEulerAngles.y, transform.localEulerAngles.z);
}
}
Greetings,
Jasper