- Home /
Question by
grayfeisgood · Oct 28, 2020 at 01:55 PM ·
rotationrotaterotate object
How do I get the rotation to work past the sensitivity?,
The character rotates until it hits the sensitivity or the opposite of it as the y rotation value. How do I get it so that the sensitivity is only the speed and you can keep rotating in one direction for as long as you have the button down?,
screen-shot-2020-10-28-at-84605-am.png
(155.7 kB)
Comment
Best Answer
Answer by Quelfth · Oct 28, 2020 at 06:38 PM
The character only rotates until it hits the sensitivity because Input.GetAxis("Camera") is a value between -1 and 1 which you are multiplying by sensitivity. You should probably change your "Camera" input axis in the input manager so that it has 1000 gravity and sensitivity (Edit > Project Settings > Input Manager). Then you'll want to change your fixed update method to this:
public void FixedUpdate() {
float angle = Input.GetAxis("Camera")*sensitivity;
Quaternion rotationToPerform = Quaternion.AngleAxis(angle, Vector3.up);
transform.rotation = rotationToPerform*transform.rotation;
}