- Home /
This question was
closed Dec 01, 2014 at 04:20 PM by
SaraCecilia for the following reason:
Too subjective and argumentative
Question by
billyjoetyler · Dec 01, 2014 at 04:14 PM ·
clamp
smoother rotation
hi, I am using mathf.clamp to limit the rotatin of a barrel in unity, but its jerky. Here is the code:
#pragma strict
var current_rotation : int = 0;
var Extra_Rotation : float = 1.05;
function Start () {
}
function Update () {
}
function FixedUpdate () {
current_rotation += -Input.GetAxis("Vertical") * Extra_Rotation;
current_rotation = Mathf.Clamp(current_rotation, -20, 15);
transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, current_rotation, transform.localEulerAngles.z);
}
if you know anything I would appreciate it.
Comment
Follow this Question
Related Questions
Working out Difference in Rotation 2 Answers
Modify distance with var? 1 Answer
Counter issues, hitting -1? 1 Answer
Raycast - Clamp Math Issue 0 Answers
How to Clamp X-axis Movement only? 1 Answer