Hey Guys! I’m currently working on a FPS experimental hobby thingy, and i’ve run into problem recently:
To make the whole thing look more realistc i tried to implement the movement a weapon does in every normal FPS, where the weapon rotates up to a certain amount of degrees based on the speed of your input, f.e. the speed you’re giving your mouse. At the moment i’ve got this code:
private var start_rotation_y;
function Start() {
start_rotation_y = transform.localEulerAngles.y;
}
function FixedUpdate() {
var mouseSpeedX:float = Input.GetAxisRaw("Mouse X");
var speedRounded:float = Mathf.Round(mouseSpeedX * 3);
transform.localEulerAngles.y = start_rotation_y + speedRounded;
}
The problem with that is, that the weapon moves but the movement is very jittery, when I would rather have it being smooth and due to this realistic looking.
I’ve tried a few things, but they all ended up being jittery, so i hope someone in the community knows a proper fix for that!
Greets, remoteplayfreak!